Question by
hpluvia · Jul 04, 2016 at 04:05 PM ·
scenescene-loadingscene-change
How Can I Open Previous Scene?
Opening "Dead Scene" when player is dead. And there is again button in "Dead Scene". If player click it, i want to open scene again. I have an idea but it is useless.
If you know best or easiest way to do this. Can you tell me?
Thank you.
Comment
Best Answer
Answer by Jessespike · Jul 04, 2016 at 06:22 PM
Make a variable that keeps track of the scene, update the variable when switching scenes.
public static string PreviousScene = "";
public void LoadScene(string sceneName)
{
PreviousScene = SceneManager.GetActiveScene().name;
SceneManager.LoadScene(sceneName);
}