Android not saving after quit

Discussion and help for Easy Save 3
Post Reply
PhoenixAds
Posts: 4
Joined: Wed Jul 29, 2020 9:58 am

Android not saving after quit

Post 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

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

Re: Android not saving after quit

Post 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
Joel @ Moodkie Interactive
Twitter - Unity

PhoenixAds
Posts: 4
Joined: Wed Jul 29, 2020 9:58 am

Re: Android not saving after quit

Post 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?

PhoenixAds
Posts: 4
Joined: Wed Jul 29, 2020 9:58 am

Re: Android not saving after quit

Post 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

PhoenixAds
Posts: 4
Joined: Wed Jul 29, 2020 9:58 am

Re: Android not saving after quit

Post 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

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

Re: Android not saving after quit

Post 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
Joel @ Moodkie Interactive
Twitter - Unity

Post Reply