Creating our Game Over Scene| Unity 2D
Objective: Reboot our player lives after it’s game over.
First, create a UI text under your Canvas game object. Rename it. Set your text to Game Over and give it a color.
In my UIManager script I will create a variable that will store our game over text.
Drag the text to the empty variable slot we just created.
Back in our UIManager script, when the game starts we want the game over text by default to be set to false so we don’t see it.
Finally, when do we want the game over text to appear? When the game is over obviously!
This will happen in our UpdateLives method. When the player is at its last life we will display the game over text by setting SetActive to true when lives is equal to 0.
We now have a fully functional game over screen when our player dies.