Saving isnt working in my game correctly/ How to make saving work better?

This is the way I have saving set up in my game currently:


And this is how I read the save:

and here’s how I make it change the level:

This does actually work, but it only loads Untitled scenes. Even when I save in “jacobs house”

I’m mainly looking for a fix, but if anyone has a better way I could rework this it would be appreciated as well.

Thanks

Have you run it with the debugger? I’d like to know what Level contains, because my guess it’s a JSON formatted string after you’ve saved the value.

You’re reading from storage into scene variable Slot1. But you haven’t put the value of Slot1 into the global variable Level.

Where do you increment global variable Level?

Either the events sheet is missing events, or you’ve omitted a few important events in your screen shots.

The only thing I didn’t include was this line of code:


I don’t really know what " increment global variable Level" is, so that’s probably where I went wrong lol.

I don’t know your game… so i can’t give you the right code that suits your project, there are different possibilities.
Do you have a level select menu? Should it change the level directly after the app start?
What exactly do you want to save when? e.g. the highest unlocked level when a level is finished…

I have a Save slot system, and there are save points in each level that save your progress. Just for clarification, my game is a story-based RPG.

That’ setting a global variable, whereas your conditions are checking a scene variable :

doesn’t it need to be a scene variable because I’m saving it in a global variable and then parsing it into a scene variable?

I forgot to include this screenshot as well

Sorry, it just means the value is increasing, that it has another number added to it.


I don’t understand why you are parsing it, unless it’s a structure. You should just write the value to storage, and read the value from storage. No need to parse if it’s just the number that you’re saving.

So the read process should be "Read from storage into a scene variable" and "copy the scene variable value to the global variable". And the write process is just "write the variable to storage".

But, since you are reading from, and writing to, storage, you can just use the scene variable and not use the global variable.

Also, make sure you’re reading and writing a number, not a text/string.

I still don’t know exactly how your system is supposed to work.
But I could imagine it like this.


1 Like

ooo I’m definitely going to try this, ill get back to you if this is better