Advertisement
Guest User

Coroutine 3

a guest
Mar 12th, 2016
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.25 KB | None | 0 0
  1. private bool canSpawn = true;
  2. void Update () {   
  3.         if(canSpawn)
  4.             StartCoroutine(WaitTime());
  5.     }
  6.  
  7.     IEnumerator WaitTime(float seconds)
  8.     {
  9.         SpawnEnemy();
  10.         canSpawn = false;
  11.         yield return new WaitForSeconds(seconds);
  12.         canSpawn = true;
  13.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement