Hi. I added the ability to save achievement completion in my new app and it works fine most times. But sometimes the data is not saved before a load action is executed resulting in wrong display or lost data.
I tried some things like wait for signal but I could not make it work yet.
First I tried the save/load actions but when I go to home layout after load complete I had an endless loop (needs loader layout I think) and I had problems with persistent object positions. So I changed to local storage and dictionary.
User clicks Sprite. Frame is switched and saved to dictionary. Key is the uid, value the frame number.
On End of Layout (does this work on closing the app?) the dictionary is saved to local storage as json.
On start of layout local storage get item is executed. On get item complete json is loaded into the dictionary.
Then right below a for each key loop sets Sprite with key (uid) and switches frame to the value.
The problem is when you load the same layout or switch too fast the data was not saved properly. Any ideas how to fix this and wait until data is stored?