Please can someone help me with saving variables?

It is working for saving my name text variable but using same code for saving integer variables just won’t save. This is in unreal engine.

When I package my game, saving my name text variable no longer works.

I have selected every file to be included in cooking/building/packaging.

Here is save file blueprint:

If you would like any more pictures please do ask

Hi ,

It’s a little hard to follow with that image, but I don’t see anything explicitly wrong with your setup except for one point: in second part of your main sequence on Event Begin Play, Does Save Game Exist and following Branch are not connected, so that Branch is always returning false. It doesn’t look like XP is ever being loaded.

I wasn’t able to reproduce any problem with save system in a packaged project, either. Can you reproduce this in a new test project? If so, can you upload it somewhere for me so I can take a look? Thanks!

I connected that and tried again, nothing changed, it keeps creating a new save file for my xp, I dont understand why.

I’ll try re-create it in a new project…

Thanks

i recreated it in a new project and both problems have gone!

change I did was get visual numbers to read directly from save file!

I’ll now try this in my main project…

name works but numbers dont

exact same thing works in my new project, can i send you my main project privately ? My brain is blowing up …

ah in new project, number stopped saving, though it worked before i opened my main project, i have changed nothing…
I keep stopping it, starting it and changing a number (which saves) and stopping it and starting it, sometimes it saves, sometimes it doesnt…

weird bug, I think it happens when you want to save more than 1 variable.

Possibly. Lemme get both your project and test project. If you can them up and upload them someplace like Google Drive or Dropbox, you can send me a link via forums, here:

Make sure you give me repro steps for both. Thanks!

uploaded and sent link to you :slight_smile:

thanks

Hey ,

Ah, I apologize, I didn’t notice this in images you provided, but problem is that you’re overwriting Save Game Object in a bunch of places, and it’s only remembering last one you saved. Since you’re trying to create three separate Save Slots, you need to use three different variables. Instead of singe Save Game Object variable, create a Save Game Object called Save Slot XP, and another called Save Slot Name, etc.

In test project you sent me, it would look like this:

Let me know if you have any questions about that. Hope it helps!

ah ha thank you! This was never mentioned in any tutorial i saw lol.

its all working now :slight_smile:

how would i reset saved variables for distribution ?

You shouldn’t need to. When you package game, it doesn’t include any existing .sav files. packaged game will create its own.

If you want to be doubly sure, you can implement an option to clear all saves in a menu somewhere, and then simply overwrite these all with a blank Save Game Object. Just create a Save Game Object and don’t feed it any variables, and that should leave them all as their defaults.

I did package game and it still had my saved data.

It is on for distribution and full rebuild.

Yeah I can do that thanks

Hm, I’ll look into that. Thanks!