All changes are not saved when app crashes

Discussion and help for Easy Save 3
Post Reply
BFRETHGIL
Posts: 23
Joined: Wed Jun 13, 2018 8:25 pm

All changes are not saved when app crashes

Post by BFRETHGIL »

When I quit my app or pauses it, everything is fine and saved

but if the app crashes on my ios, when I restart the app, all the changes reverted to the last time I paused the game.
for example, I played my game and got to level 9, the app crashed and when I restarted it, it was back to level 4 again (because level 4 was the last time I paused the game manually and without a crash)

Code: Select all

private void Awake()
    {
       
        if (instance == null)
        {
            instance = this;
            file = new ES3File("myFile.es3");
            scores= LoadFromFileES3("scores", -1));
         }

        else if (instance != this)
        {
                  Destroy(gameObject);
        }

}

public void OnApplicationQuit()
{
file.Sync();
}
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: All changes are not saved when app crashes

Post by Joel »

Hi there,

OnApplicationQuit or OnApplicationPause is not called when the app crashes because no code can execute after a crash.

Instead of saving using these events, you might want to consider saving more regularly. For example, saving when a player finishes a level.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply