Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

Why enemies are inactive?

$
0
0
I have a shooting game, in which four enemies appear by sequence one after another. What happens is that only the first enemy appear, and others don't appear until i check one of them as active during run the others become active too. Here is the code:- void Awake () { enemy [1].SetActive(false); enemy [2].SetActive(false); enemy [3].SetActive(false); } void Start() { enemy [0].SetActive(true); StartCoroutine (Wait ()); StartCoroutine (Wait1 ()); StartCoroutine (Wait2 ()); } void Update() { InvokeRepeating ("Wait", 3f, 4f); InvokeRepeating ("Wait1", 3f, 5f); InvokeRepeating ("Wait2", 3f, 6f); } IEnumerator Wait() { yield return new WaitForSeconds (2f); enemy [1].SetActive(true); } IEnumerator Wait1() { yield return new WaitForSeconds (3f); enemy [2].SetActive(true); } IEnumerator Wait2() { yield return new WaitForSeconds (5f); enemy [3].SetActive(true); }

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>