Learn to code by making a 2.5 D space shooter game.
Objective: Implement Game Over Text when a Player is Dead.
The first step is to create a text component and rename it Game Over Text.
Rename the text to white color, change the fonts then snap it to the center, when you increase font size the text will be cut to solve the issue go to horizontal overflow and vertical overflow drop down both select overflow.
Let's rename it to Game Over, then disable game Object by default.
We need to create a Game Object variable to have a reference to the Game Over text Object.
Then go to the inspector right click and hold to drag, game over text Object into the Game Object field on UIManager.
We need a method for activating the game over text Object, this method needs to be public since we will call it outside the UIManager script.
We call this method when the Player died inside TakeDamage method in Player scripts.
This is how we Implement Game Over Text