Quantcast
Viewing all articles
Browse latest Browse all 4

Answer by Bunny83

Another way would be to Use an infinite loop inside the Coroutine. But the disadvantage is that you can't stop it from outside. To be able to stop it you could again use a boolean outside of the coroutine. function Start () { RandomPowerup(); } function RandomPowerup() { while (true) { yield WaitForSeconds(5); // // ... // } } or to be able to stop it use something like this: var RandomPowerup_allowed = true; function RandomPowerup() { while (RandomPowerup_allowed) { Note that I start this coroutine only once at Start, not in Update!

Viewing all articles
Browse latest Browse all 4

Trending Articles