When building a game in unity it is done in a modular way. At the moment with our space shooter we have been working with one scene. If the game ends we would want to reload that scene, here's how:

Like the Game over text we will add some more text to read “Press the ‘R’ key to restart the level”

Create an empty object called “Game_Manger” and attach a C# script to also called “GameManager” Unity will recognise this and change the logo to a cog.

Within the script make sure to add the namespace “UnityEngine.SceneManagement” this will allow you to use the class “SceneManager”

We want the option to restart the scene to only show when the game is over, so we have a method which has bool for true. With this in place we can add an if statement for when R is pressed restart the scene.


this will load the scene at index 0. You can see your index number in the building settings and you will also have to “add open scenes” to the build to be able to load scenes like this.

Build settings

Now this is set up within the game manager we need to let the UImanager know to communicate with it.

with this we let the UI manager know about the game manager so we can it let it know the game is over.

As part of our Game over sequence we run the method.

Reloading the scene

Aspiring Unity Developer