Road TO Dev — Player is gone! Enemies STOP!

Ok so that just doesn’t make sense does it? Now that our player is dead the enemies should just stop spawning. Well let’s make sure that happens. First we need to setup the thing that controls the enemy spawn to recognize death. That’s a simple yes/no question so a bool works great.

Now we just need to check that bool in our while statement and create a new PUBLIC method for our player to communicate with to effect that bool.

Alrighty that should be all we need on the spawn manager now over to the player. First thing we need to make the player aware of the spawn manager as an object.

Now remember we serialize the field so we can add the spawn manager to the player. Lets do that now.

Now we just need to trigger the method on the spawn manager when the player is at zero lives.

There you have it now the enemies should stop spawning after the player has died!

Hi there! I am currently on the path to learn how to become a unity developer and will be documenting my journey as best as I can here. Thanks for looking!