Creating a Lives Display And Respawn System

Matthew Clark
3 min readMay 20, 2021



Create a system to will subtract lives when the player falls off the platforms. It will update the lives display and reset the player's position.

Adding the Lives Display

To create the lives display you can duplicate the coins display and change the text to reflect the lives. You will also position this text above the coins text.

In your UIManager script create a reference to the lives text and set up a class to display the current lives.

Setting Up Lives System

In the player script create a variable to hold the lives.

Create a class that will check the player's y-axis value. If it is less than or equal to -8 subtract one life from the player's lives counter and update the lives display.

Make sure to call this class in a fixed update to avoid more than one life being subtracted.

Respawning the Player

To respawn the player you will need a reference to the spawn position. To get this create a duplicate of the player game object. Child the duplicate to the player and zero out the position and then unchild it. You will also remove all components and rename the duplicate.

Respawn_Point is the Duplicate

Add a reference to the player script.

When the player falls and loses a life set their position to the respawn point.

This will get the player falling losing one life and then respawning.

Resetting the Game at Zero Lives

To do this create an empty game object, zero out the position, and rename it to GameManager.

Create a new script and name it GameManager and attach it to the GameManager object.

Make the GameManager script a singleton and add a class to reload the scene.

In the player script in the class to update lives create the logic that will call the reset scene class in the GameManager when the lives are zero.

This will reset the game when the lives are at zero.

Note: Make sure to add the scene to the build settings to get the correct index to load



Matthew Clark

Game Developer and Programmer