Last active
March 25, 2018 02:50
-
-
Save NovaSurfer/e96f3777ca7a4c46f391634ec65dc695 to your computer and use it in GitHub Desktop.
Restart current scene in Unity 5.0 using new SceneManager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
For more details, please follow the link below: | |
https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.html | |
*/ | |
using UnityEngine; | |
using UnityEngine.SceneManagement; | |
using System.Collections; | |
public class SceneRestart : MonoBehaviour { | |
void Update () { | |
if (Input.GetKeyDown(KeyCode.R)) | |
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment