How do I…
After reading a structured object variable from storage, how to put this information back into the object structured variable?
What is the expected result
The values from the structured object variable that were saved in storage should be placed back into the structured object variable.
Explain what should happen when you run the game.
The structured object variable should be repopulated with the values it had at save time.
Explain what is happening instead, what is going wrong.
Instead, even though my string comes back fine and with the correct variables, and the parsed information comes back fine as a structured scene variable, when I use the same “convert” action on the string for an object variable that I had used on the scene variable, the object structure maintains its default values. I feel like I am overlooking something so obvious. But I’m too tired to think and I missed you guys anyway.
Please include a screenshot of the full related events including both conditions and actions.
And screenshots to help showing us the issue.
Summary
Scene variables:
Object variable, all default value.
Just editing to add yeah I know I can just add them one at a time by setting each individual one to the corresponding scene var.
Just editing to add if I Clear children from variable Stats of AnimalHabitats right before the Parse JSON string VariableString(TVar) and store into variable Stats of AnimalHabitats, then Stats just shows up as an empty structure with no children.
Another edit, when I tell it to change the text of AnimalHabitats var Stats set to TVar, it correctly changes to the string.
But when I tell it to do that and then add Parse etc right behind it, the value of Stats is still the string.
Ok so since I discovered that it would change the text of the object variable correctly, even though it would not parse a text into the object variable correctly, I simply called it to store the text into the object variable, then in later beg of scene events where I have a group of events to be done For Each AnimalHabitat, I call it to parse the text I stored into it and put it back in the same variable. Everything is correct now.
Ok new update. Tonight I made a copy of the game and changed my save system to storing the structured object variables inside a structured scene variable that I have set to save the other game values, instead of their own separate save system. I chose to append them to an array in the scene structure as JSON at save time, since I will not be needing read or update their values as scene variables during runtime. I only need to get the info out in the beg of scene to create the objects and repopulate the objects structured variable with the correct information, or to clear all the children and append the new JSON at save time.
So with this new setup I did not run into the minor issue of the last set up. I was able to immediately repopulate the objects structured variable after creation. Not sure what the difference is but adding it here for comparison.
It makes me think the first issue was some error in the way I set up the other save system.