Create an Empty Object and name it spawnManager.

Create a new C# script and name it spawnManager.

Drag the script onto the eponymous empty game object, giving it form and meaning.


We’re going to implement a Coroutine and WaitForSeconds.


  • spawn enemies every 5 seconds across a randomX
  • create a coroutine of type IEnumerator — Yield Events
  • while loop — the infinite game loop — continues running so long as the prescribed condition is true — it could be infinite and crash your dang computer
  • but Yield Events act as our pause button

Into the script: