The retro “Gameover” text in Unity

After putting up the score and player lives image on both top-end corners, it is the right time to implement the “Game Over” title.

The look shall come with just a few steps if the canvas is already in place. In case, you have not done so, please revert back to the last article here.

  • First, please put a text element and change the text to “Game Over”.
  • Second, choose the font of your choice. (Please use the asset store in case you are not having many options to choose from.)
  • Third, select the “Overflow” option in the horizontal and vertical overflow dropdowns as these would allow the title to get bigger while changing the font size.

This shall put up the text element as wanted.

However, the task is to have it displayed when the player dies. Let us implement it in code.

  • First, declare a serialized field variable in the UI manager script.
  • Drag the text element to the field.
  • Disable the text element in the inspector and in the start( ) method, utilize the setActive( ) to disable it when the game starts.
  • Then, the method which handles the lives update, go ahead and use the same method to enable it when the player dies.
  • Below is the result. But something is missing, right?
  • Let us make a coroutine that enables-disables the element at a regulated interval of 0.5 seconds.
  • The final result is here :)

Thank you very much

Work in Progress.