Save an array to storage and call it back still as an array(solved)

How do I…

Save a (massive) array variable to the deveice, and call it back as an array.
I know that you can store texts and numbers, and there may be a way to do so with the ToJSON() and the parse JSON and store in variable action, but i am unsure,

This would use 3 buttons and the scene variable string named temp.
It saves the array Players to Options in Game Storage.
(You can use whatever you want for the storage names)
I set temp to “” because you said the array was large. If temp wasn’t needed anymore, it might as well be set to "nothing.

This is the save. It’s a mix of save text to storage and ToJSON

1 Like

ah, ok, thanks!
I though this might be the answer, as i saw it worked for a structure variable on youtube.

Yes, it works for structures and arrays. To save it converts the variable to a JSON string and then saves the string to storage. To load it loads the string that’s in JSON into a string, and converts the string to a variable.

1 Like

hmm, for some reason it will only call back one number child with the value of zero. Any ideas?
my events:


and for some reason events reference a scene variable with the same name as the global array, but i cant find it

ahHA!!
found it.
the ToJSON() thing wants a scene variable, despite me wanting a global variable, i just need a temporary varible, and ill be all set, thanks!

1 Like

I’m glad it’s working. I thought I’d share my example. There are some concepts that I don’t have memorized. So, I usually make a test project. I played with it afterwards. It demonstrates using an array of structures. I think it would be much easier. You can add as many children as you like. The basic concept is that you build a structure and then add it to the array.

Try me: Objects are draggable, right click toggles the animation.

source: (click the green [code] and [download zip])