Auto save - Saving current scene and loading back into it
Posted: Fri Nov 12, 2021 1:41 am
Hi,
What is the proper way to load into the last saved scene from a main menu button (using autosave)?
If I call this using the main menu "load" button, nothing happens:
So I tried doing this workaround, but it seems a bit buggy:
I'm saving using an on-screen button, which uses ES3's autosave, then saves the current scene manually as "savedScene":
Then on my main menu "load" button I load back into "savedScene":
Then in my scene I load the ES3 autosave values for player position, etc. on Start:
Am I going about this correctly? Or is there an easier, simpler way to do this?
Thanks!
What is the proper way to load into the last saved scene from a main menu button (using autosave)?
If I call this using the main menu "load" button, nothing happens:
Code: Select all
ES3AutoSaveMgr.Current.Load();
I'm saving using an on-screen button, which uses ES3's autosave, then saves the current scene manually as "savedScene":
Code: Select all
public string currentScene;
public void Save()
{
ES3AutoSaveMgr.Current.Save();
currentScene = SceneManager.GetActiveScene().name;
ES3.Save("savedScene", currentScene);
}
Code: Select all
public string sceneToLoad;
public void Load()
{
sceneToLoad = ES3.Load<string>("savedScene");
SceneManager.LoadScene(sceneToLoad);
}
Code: Select all
public void Start()
{
ES3AutoSaveMgr.Current.Load();
}
Thanks!