Journal 22 — Retro Game Over in Unity

Chris Nielsen
May 6, 2021

Following up my previous journal, after losing all lives, we want to show a game over message.

In the UIManager script, where we are updating the images of the spaceships as lives are lost, we can access a new method in the same script to start a game over sequence.

UIManager script to update lives onscreen and start the game over sequence

In the GameOverSequence method, we will do three things: set active the game over and restart text, start a coroutine to show the game over text as retro style flashing, and call a method to allow for the game to be restarted (more on this in a later journal).

UIManager script and game over sequence

In the GameOverFlicker coroutine, we create a series of actions to show the game over text, pause, hide the text, pause, and repeat.

UIManager coroutine to generate flicker of game over text

See the results of the coroutine in play.

Unity Playmode, game over!

Thank you for stopping by!

--

--

Chris Nielsen

An Engineering Manager consultant who is seeking additional skills using Unity 3D for game and application development.