unity hide/show text

using UnityEngine;
using System.Collections;

public class PlayerController:MonoBehaviour
{

    public UnityEngine.UI.Text winText;
    void Start(){
        winText.text = "You Win!";
        winText.gameObject.SetActive (false); //hide winText
    }

   ....
   
    void OnTriggerEnter(Collider other){
        if (other.gameObject.tag == "Coin") {
            other.gameObject.SetActive(false); //hide coin
         winText.gameObject.SetActive(true); //show winText
            
        }

    }

}

posted on 2015-03-23 21:59  wantnon  阅读(464)  评论(0编辑  收藏  举报

导航