using UnityEngine;
using System.Collections;
public class LEv4O_shieldshow : MonoBehaviour {
public GameObject shield ;
// Use this for initialization
void Start () {
StartCoroutine (Active_NotActive ());
}
IEnumerator Active_NotActive()
{
if (shield.activeSelf == false) {
yield return new WaitForSeconds (10);
shield.SetActive (true);
}
}
// Update is called once per frame
void Update () {
}
}
what i am try to do is to put if condition
if the game object is false
wait 10 secounds
then make it true
but doesn’t work
why ? !
Don’t know what is your code for, but whatever, just try this:
IEnumerator Active_NotActive()
{
if (shield.activeSelf)
{
yield return null;
}
else
{
yield return new WaitForSeconds(10);
shield.SetActive(true);
}
}