Restart level in Unity

Give the option to start again

Rusben Guzman
Jan 7, 2022

Objective: write a code to load the game scene and call it when the player selects the option.

The first step is to go to the UIManager script and create a public function called Restart. For this implementation we need the namespace UnityEngine.SceneManagement.

Within the function we have to use the function SceneManager.LoadScene and pass as a parameter the name of the scene of the index (remember to add the scene in the build settings).

And that’s it!!! We have a functional restart button.

--

--

Rusben Guzman
Rusben Guzman

Written by Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

No responses yet