Auto save - Saving current scene and loading back into it

Discussion and help for Easy Save 3
Post Reply
manta__fanta
Posts: 7
Joined: Sat Oct 16, 2021 5:20 pm

Auto save - Saving current scene and loading back into it

Post by manta__fanta »

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:

Code: Select all

ES3AutoSaveMgr.Current.Load();
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":

Code: Select all

    public string currentScene;

    public void Save()
    {
        ES3AutoSaveMgr.Current.Save();
        currentScene = SceneManager.GetActiveScene().name;
        ES3.Save("savedScene", currentScene);
    }   
Then on my main menu "load" button I load back into "savedScene":

Code: Select all

    public string sceneToLoad;

    public void Load()
    {
        sceneToLoad = ES3.Load<string>("savedScene");
        SceneManager.LoadScene(sceneToLoad);
    }
Then in my scene I load the ES3 autosave values for player position, etc. on Start:

Code: Select all

    public void Start()
    {
        ES3AutoSaveMgr.Current.Load();
    }
Am I going about this correctly? Or is there an easier, simpler way to do this?

Thanks!
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Auto save - Saving current scene and loading back into it

Post by Joel »

Hi there,

The way you’ve described is the correct way of going about it. Auto Save is for saving and loading Components in a scene, so you need to be in the scene for Auto Save to be able to load.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
manta__fanta
Posts: 7
Joined: Sat Oct 16, 2021 5:20 pm

Re: Auto save - Saving current scene and loading back into it

Post by manta__fanta »

That's great to hear, thank you!
Post Reply