Loading Scenes in Unity
How to Restart the Game
To load Scenes in Unity through scripting we need to add the code library of SceneManagement at the top of our script:
using UnityEngine.SceneManagement;Get Tristan Engel’s stories in your inbox
Join Medium for free to get updates from this writer.
To reload the current scene use the following code:
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);We also added some text so the player knows which button to press to restart. Be sure to add on check to see if the game is over or not, so the player can only restart when the game is over.










