When my game ends I want it to automatically restart from the beginning so that the whole scene repeats itself. How do I do that in Unity 3D?

Please refer this link for clarification.

  • \$\begingroup\$ I think SceneManager.LoadScene(0); might interest you \$\endgroup\$
    – Foxwarrior
    Oct 10, 2019 at 3:19
  • 1
    \$\begingroup\$ Questions on Stack Exchange should be as self contained as possible. Very few users are going to go off-site to check out your project in order to answer your question. Please consider making a minimal, complete, and verifiable example instead. \$\endgroup\$
    – Pikalek
    Oct 10, 2019 at 3:35

2 Answers 2


To restart your current scene, you need current scene index or name. And once you have the current scene index or name then just reload it. Here the example that how i done it:

public void RestartCurrentScene()
     int currentScene = SceneManager.GetActiveScene().buildIndex;

Add this to the very top section of the script. As it is required by "SceneManager".

using UnityEngine.SceneManagement;

I hope this will help...


you can use this code:

    UnityEngine.SceneManagement.SceneManager.LoadScene( UnityEngine.SceneManagement.SceneManager.GetActiveScene().name);
  • 2
    \$\begingroup\$ This looks equivalent to Swati's answer, but with less explanation and with the added expense of string lookups. Can you clarify why you feel it's an improvement over the existing answer? \$\endgroup\$
    – DMGregory
    Oct 10, 2019 at 20:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .