thieumao

setLabel Unity3D

Feb 22nd, 2014
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class NewBehaviourScript : MonoBehaviour {
  5.     GameObject Player;
  6.     UILabel Script;
  7.     int i = 0;
  8.     void MyClick()
  9.     {
  10.         Player = GameObject.FindGameObjectWithTag("Player");
  11.         Script = Player.GetComponent<UILabel>();
  12.         if (i == 0)
  13.         {
  14.             Script.text = "AA";
  15.             i = 1;
  16.         }
  17.         else
  18.         {
  19.             Script.text = "BB";
  20.             i = 0;
  21.         }
  22.    
  23.     }
  24.    
  25. }
Advertisement
Add Comment
Please, Sign In to add comment