I am trying to use local storage for saving key variables for my game. Including a levels array. When I run the preview and check the debugger, everything shows properly saved. Where I am running into issues is loading the data. Something seems to be breaking in this process.
The only thing that works is loading my array. My levels load and their progress shows.
However, it does not load that the next level is unlocked. So if I beat levels 1 and 2, then level 3 is unlocked. But if I close out and reload, it still shows levels 1 and 2 beaten with their progress but now level 3 is locked and I have to replay level 2 to unlock it.
I figured this was due to not saving the "currentlevel" variablae which is used to ensure each level is unlocked in my events, so I started saving and loading that.
However, when that loads, now all my levels are locked and I cannot unlock them. This happens even if it is a new load. So I added a callout to set currentlevel to 0 if there is no save, but this does not fix the issue. I have even tried using an event to clear local storage to ensure nothing is accidently loading.
These issues also extend to my sound.
If I save sound and then try to load the sound, there is no sound even if it was saved as on and I can no longer toggle it.
I have attached a screenshot of my loading events. The On Item Get for the sound is removed because I was trying to focus on getting the levels to work properly first. Any help is truly appreciated.