Enemy Wave System

Kinga Osińska
2 min readMay 14, 2021

Today we are making an enemy wave system. We will make 5 waves for our game. With every wave, there will be more enemies spawning. We will also change the time between enemy spawns.

First, we need to decide how many waves will be, how many enemies per wave, and how much time must pass between spawning enemies in each wave. Open the SpawnManager script.

We also need to check if all the enemies in the wave were destroyed. As we spawn our enemies, we will add them to a list, and remove them, when they are destroyed.

We also need to check if all the enemies in the wave were destroyed. We will use WaitUntil to do that.

We will add a new Text GameObject to inform our player which wave is starting.

In the UIManager we will active the wave text for 3 seconds.

In the Enemy script, we need to find the SpawnManager script and remove the enemy from the list before we destroy it.

In the Start() method
before Destroy(this.gameObject, 2);

--

--