0
Answered

How use save variables on Android ?

Nikita 2 years ago updated by Bez Zaman 10 months ago 8

I think its not bolt issue / i miss something in general ,but what?

I have Save variables that control what level is opened. They work good inside unity.if i restart will be loaded all changes

  But dont work if i build for android and install on smartphone. Saved data dont load if i restart application/Its always like fresh and new install.   

maybe i need indentify google user ID ? or something else

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

first i thought it is cos AOT list -but  simple bool  variable dont load too  -they both  works good on android during session-they react on changes  .but  their saved data dont load at restart

 so i think  its something in general /

 bolt 1.2.3   

p.s. in build player settings  write permission is external. so data should be saved  on smatphone as i understand

Pending Review

Do you get any error or warning in your Android build or debug?

i dont get  warnings during build or gameplay yet

 I runed app in Android studio without debug and only i can say it read  Initial Save variables . but not Saved

Im new to this process and  i cant debug yet becouse dont know where take debug symbols for Android studio. And didnt find answer in google yet. I builded apk in development build but still get this messages /Maybe i will ask about this on Unity forums becouse its not bolt issue and give more information (if any) later. 

Sorry for a lot of images. I made test scene. If i run game inside unity and toggle buttons images will be red. and this info saved to variables / Then i restart second time and  Images get info from variables and if true they will be green/

But in android studio if i do the same -play and then restart i get all white 

Scene - Savevariables.unitypackage

Bolt apparently writes to disk when OnApplicationQuit is executed. Therefore, if you slide any application to close it on Android, a forced shutdown occurs, so variables will not persist.

+1
Answered

Hi German,

As indicated in this thread, Bolt will soon also save in OnApplicationPause:

https://support.ludiq.io/communities/5/topics/1434-when-are-saved-variables-set-to-initial-state-again

If you still encounter this issue in the next version, please start a new topic!

Hi I’ve been getting this same problem, my saved variables work perfectly as they should when I’m testing my game on unity, but when I test it on iPhone, it doesn’t work. Has anyone found a soloution for the saved variables to work on AOT’s. it seems the saved variables don’t exist when I play the game on the iPhone.