Page 1 of 1

Android not saving after quit

Posted: Wed Jul 29, 2020 10:03 am
by PhoenixAds
Hi there.

I am saving a bool, once the player competes training level with playmaker save. This works in game on Android as when you return to start level after completing training and saving bool as expected. I load the bool and correct door opens. I can reload level in game again and bool is still correctly set.

However if I quit the app, then relaunch, the bool is reset back to initial state.

I've tried also saving to playerprefs but getting same result is there some process I am supposed to follow for the saved bool to be written to disk permanently?

Any help greatly appreciated

A

Re: Android not saving after quit

Posted: Wed Jul 29, 2020 10:20 am
by Joel
Hi there,

If this is also happening with PlayerPrefs then it's almost definitely due to an issue in your project rather than the data failing to be stored. For example, the bool is being changed after the data has been loaded, or it isn't being saved. Firstly I would check that your Save and Load actions are being called, and there's no errors being output to the Android debugger.

If this doesn't reveal the issue, would you be able to to create a new project from scratch, and replicate your issue in there with the minimum content required?

All the best,
Joel

Re: Android not saving after quit

Posted: Wed Jul 29, 2020 10:59 am
by PhoenixAds
Thanks for the quick response, sadly for me, I think you are right, just building a whole other simple project to test and it's working fine :(

So I'll need to rip mine apart and find out where the failed logic is, fingers crossed I can find it!

Out of interest, what's your suggestion for resetting save data, for example things that you do want to be only consistent per session, do you just set default values to global variables and resave?

Re: Android not saving after quit

Posted: Wed Jul 29, 2020 11:42 am
by PhoenixAds
Ah okay progress but not fixed actually, sorry spoke to soon. Will save permanently in editor but still not saving on Android device, I'll get a test project over to you shorty. Have tried default and playerprefs already

Re: Android not saving after quit

Posted: Wed Jul 29, 2020 12:55 pm
by PhoenixAds
Okay, lot's of messing around, you can mark this solved now.

I used debugger in playmaker and realised that it was reading before load was complete, couldn't see on high spec laptop, so added a "next frame" between load and read of bool and all working amazing now. Love this asset so much, thanks for all the hard work

Re: Android not saving after quit

Posted: Wed Jul 29, 2020 1:05 pm
by Joel
Glad you managed to find a solution to your problem, let me know if you run into any other issues :)

All the best,
Joel