I have object I want to control it by show and hide it.
using UnityEngine; using System.Collections; public class DeadLife : MonoBehaviour { public float O_Life = 100f; // Use this for initialization void Start () { } // Update is called once per frame void Update (){ if(O_Life <= 90f) { gameObject.SetActive(false); } if(O_Life >= 90f) { gameObject.SetActive(true); } } }
If O_Life <90 it hide. Good
But if i want to get it back “show or appear it again” it not work !?
So, How to fix this ?