Restart level in Unity
Give the option to start again
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.