Save file disappears on exit.
Posted: Sat Aug 31, 2019 1:58 am
Hi, I'm using easy save 3 on Unity to save my mobile game's data.
Sorry for bad english in advance. I'm trying to explain as best as I can.
I found extremely serious problems after I released this mobile game.
First one was about saving and loading scriptable object. I still don't understand the reason, but when I load one of my custom type scriptable object into default scriptable object that exists on editor, by using script referencing that object, the reference disappears. I use [SerializeField] to put that scriptable object on script, so usually I see that object's name on inspector. However, when I load the data and put it into that object by script, its name becomes empty and whatever I do on that script doesn't change anything on the scriptable object that I can see on editor. Real strange thing is that there are three scriptable objects with same types, but this problem occurs on only one.
Anyway, I solved the first problem by loading data on new local variable at first, and then put each value that loaded one keeps to referenced scriptable object.
Second one is the real problem.
I save some data on exit by using es3.save~ codes on OnApplicationFocus(false). For most cases, it works very well without any problem.
However, sometimes, like less than 1%, when I reopen the app, the whole save datas are gone.
Then I found that some data I saved on OnApplicationFocus was not being saved when I quickly quit my app after app lost focus.
Code was like save A-> save B-> save C, and I found some data of C is neglected and not saved.
I thought it was matter of time, so I reduced the amount of data saved on exit as much as I could.
Still some people report that their whole data are completely gone.
The question is,
1. Should I avoid saving data on exit like that? Is it possible to cause problem if user quits app too quickly when I use es3 codes on exit?
2. Is their anyway to debug this?(ex. see saved data from installed app so that I can be sure is this the problem of loading or saving(exit)->solved, I found the directory on mobile device.)
This occurs scarcely, so it is really hard to replicate. Sorry for little info.
This app is on live and I'm in emergency. Thank you for your fast help in advance.
+I found another strange case. Normally, SaveDta.es3 file with about 8kb should exist on save directory. Once, that file was deleted and only SaveData.es3.tmp of 0B file was there. Still when I reopened the app, save data was loaded without any problem. By the way, can I ask why .tmp files are being generated?
Sorry for bad english in advance. I'm trying to explain as best as I can.
I found extremely serious problems after I released this mobile game.
First one was about saving and loading scriptable object. I still don't understand the reason, but when I load one of my custom type scriptable object into default scriptable object that exists on editor, by using script referencing that object, the reference disappears. I use [SerializeField] to put that scriptable object on script, so usually I see that object's name on inspector. However, when I load the data and put it into that object by script, its name becomes empty and whatever I do on that script doesn't change anything on the scriptable object that I can see on editor. Real strange thing is that there are three scriptable objects with same types, but this problem occurs on only one.
Anyway, I solved the first problem by loading data on new local variable at first, and then put each value that loaded one keeps to referenced scriptable object.
Second one is the real problem.
I save some data on exit by using es3.save~ codes on OnApplicationFocus(false). For most cases, it works very well without any problem.
However, sometimes, like less than 1%, when I reopen the app, the whole save datas are gone.
Then I found that some data I saved on OnApplicationFocus was not being saved when I quickly quit my app after app lost focus.
Code was like save A-> save B-> save C, and I found some data of C is neglected and not saved.
I thought it was matter of time, so I reduced the amount of data saved on exit as much as I could.
Still some people report that their whole data are completely gone.
The question is,
1. Should I avoid saving data on exit like that? Is it possible to cause problem if user quits app too quickly when I use es3 codes on exit?
2. Is their anyway to debug this?(ex. see saved data from installed app so that I can be sure is this the problem of loading or saving(exit)->solved, I found the directory on mobile device.)
This occurs scarcely, so it is really hard to replicate. Sorry for little info.
This app is on live and I'm in emergency. Thank you for your fast help in advance.
+I found another strange case. Normally, SaveDta.es3 file with about 8kb should exist on save directory. Once, that file was deleted and only SaveData.es3.tmp of 0B file was there. Still when I reopened the app, save data was loaded without any problem. By the way, can I ask why .tmp files are being generated?