I wanted to apply a saving system to my game so when they exit or it closes, it remember the last scene they were on. Right now here’s how levels are called
void NextLevel()
{
Time.timeScale = 1f;
if (Application.loadedLevelName != "LevelFour") {
Application.LoadLevel (Application.loadedLevel + 1);
} else {
Application.LoadLevel("Menu");
}
}
I also have a listener on the same game object to check for Android’s back button being pressed
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown (KeyCode.Escape))
Application.LoadLevel ("Menu");
}
void OnApplicationQuit(){
PlayerPrefs.Save ();
}
}
Obviously I am trying to use playerprefs to save the game, however I am having trouble implementing it. Since my loaded levels are not actual variables I was wondering the most simple way to implement this? I have never used playerprefs before and I have been reading up on it, I will update if I find something