- Home /
Load level that was previously loaded!
Hi
In my game when the player dies the scene changes to a game over scene. when the user clicks on the button I want it to go back to that specific level that was loaded
Here's my code:
using UnityEngine;
using System.Collections;
public class ResetLevel : MonoBehaviour {
void ChangeToScene()
{
Application.LoadLevel (Application.loadedLevel);
}
}
Thanks in advance!
Comment
Answer by Taorcb · Sep 05, 2015 at 08:03 AM
If you switch to a game over scene, running that code will reload the game over scene. You'll need to cache the gameplay scene's index (or it's name, either one will do) and load that.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Application.LoadLevel() changes lighting for some reason? 12 Answers
Multiple Cars not working 1 Answer
GUI Overlay Display 0 Answers