Creating a Retro Game Over Behavior

In this quick article I’ll show how I created a retro arcade style “Game Over”
Following the same setup in my last article I created a GameOver_text UI>Text object, changed my font, anchored to the center and changed the size.

I then made a variable in my UIManager script and assigned it in the inspector.

My UIManager is subscribed to an Action in my Player class that sends current Lives when the Player is damaged, if lives are less than 1 or equal to 0 then it runs the DamageSequence() method. This DamageSequence() method starts the GameOverTextFlashRoutine() coroutine.
In the GameOverTextFlashRoutine() coroutine I set the GameOver_text GameObject to Active and in the infinite while loop I set the text to “GAME OVER” and have it wait 0.7f seconds with my cached WaitForSeconds variable named _gameOverWFS. It then clears the text and waits another 0.7f seconds before repeating. It will continuously do this until the ‘R’ key is pressed to reload the scene. In my next article I will show how to load scenes.
