Page 1 of 1

All changes are not saved when app crashes

Posted: Sun May 05, 2019 8:52 pm
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();
}

Re: All changes are not saved when app crashes

Posted: Sun May 05, 2019 9:39 pm
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