Lives and Respawns

Going over how I implemented lives and respawns in my 2.5D game

Objective: Creating the lives and respawn system for my 2.5D game.

The Functionality

To get things going, the first thing I did was create the UI to represent our lives, as well as hooking up that UI to my UIManager.

Code in my UIManager class

I call these methods through my PlayerController script as needed. With this hooked up, I then created an empty GameObject and named it RespawnPoint. This will serve as the position our player respawns at when they fall off the platforms. With that, I created another empty GameObject and gave it a BoxCollider with IsTrigger set to true. This GameObject was named DeadZone and I set it up below all of the platforms.

The green highlighted edges are the box collider of the DeadZone GameObject.

On this object, I also attached a custom C# script with an identical name. I used the following code to implement everything.

With all of this working together, I get the following result:

That’s all for today! Thanks for reading!