Game Over Screen

We will create the Game Over screen slightly differently from the last two we made. Now we need to incorporate a few buttons so that the user can navigate selections and levels of the game. Buttons still fall under the OnGUI() method and can use the GUI Skin we created, so the only real concern we have is with the layout. Once again, start by creating a new Scene file:

1. Create a Scene by using the keyboard shortcut Ctrl + N keys.

2. Find the gameOver_background under the _backgrounds folder in the Project Browser and drag it into the Scene. Once again, make sure its Transform values are all set to 0, 0, 0 for the translates.

3. Create a new script in the _scripts folder. Call this one “GameOverScript.”

4. Double-click to open ...

Get Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.