Weird bug with multi-slot save/load system

Hi there, I’m relatively new to UE (2 years more or less) and I’m currently in a team working on a project. I deal with all the UI visuals and scripting + additional ones, and right now I’m working on a save/load system with multiple slots that the player can create with a custom entered name.

Usually I manage to come up to a solution on my own, but this time it’s really driving me nuts. I get a specific, weird bug from saving and loading that I really don’t understand. I tried almost everything it could come up to my mind as the possible culprit, but nothing seemed to work and I can’t seem to find the answer anywhere online.

The system I’ve built uses two savegame objects created at the start of the game in the game instance with a isvalid? Check

One savegame object is to store all play data (like character stats, inventory, level name) and the other to store video and audio settings along with slots parameters like entered name, if the slot is read only and can be used to load, and screenshot taken from a scenecapture2D attached to character’s main camera.

As for the slots system, I have 4 max placed on a grid, not accessible until first slot is taken and first save is done.

I have two setups in the main menu: new game and load game. When the player choses new game, custom text can be entered and, when committed, is stored in the savegame object and assigned to the first available game slot.


The four slots are instances of another SaveSlot widget which also stores several editable variables such as slot number, slot text, a boolean to tell if the slot has been used and so if has to be loadable or not, screenshot brush and visibility, and so on.

Individual slot save and load logic are handled by custom events in the SaveSlot widget itself with reference to the slot number when pressed.

Each time I save or load to/from a slot, the slot number is also set to a int variable in the game instance, so that I can later use it from within the character controller (where main save and load functions are) to save and load game to that same slot number, always combined with an append and string as the main slot name.
Save and load functions have both a sequencer that gets the data from the variables on the savegame object and sets them again to character, controller and inventory variables, and viceversa.

Now, save and load between levels work fine as intended, and so it seemed for the save and load from slots, cause actually I don’t get anything unusual/strange from all the print string I’ve placed, it saves and loads to and from the right slot, at least until I found out two problems:

  1. If I save on more than one slot, choose to load one first then a second one and save, when I come back to the previous one, all the variables have been overwritten with the others, both slot entered name, character variables, and so on.
  2. If I end play in editor and restart, saves are still there, but loading messes something up the first time and then deletes all saved variables on the second time I load that slot.

What I’ve tried:

  • Changing the logic to place the slot dynamically on the grid with a “for each loop“ and “add child”, also clearing and refreshing the slots array on event construct each time, just for safety.
  • Creating the savegame objects each time a save has to be done, and not only once in the game instance
  • Using a single savegame object instead of having two
  • Using the manual slot loading when pressed instead of automatically get the slot number and set it
  • Not using the sequencer in the save/load functions in the controller bp
  • Using the async save and load from slot, instead of the sync one
  • Using the “does save game exist” instead of the isvalid? node in the game instance

Nothing worked, same problem, still can’t find out what the reason is.

What am I doing wrong, or am I missing something? I’m currently using version 4.25.4
Thanks in advance.

There’s a lot of info here. But right off the bat, I see that you’re creating the save game objects if the references are not valid:

That’s going to overwrite your save game objects every time you run the game…

You need to check with DoesSaveGameExist. If it does, load it, if not, then use the create node.

You’re right, actually I did it with “does save game exist” in the first time not to overwrite save game each time, but instead, I kept getting an “accessed none” error on savegame variables and still the same problem, unlickily…

I will try again anyways, thanks. As for the slots overwriting each other even when not closing/opening play in editor, do you have any idea of what may be causing the issue?

If you’re making a new save game each time, you don’t even have to leave the editor, and it will overwrite everything you saved.

Here’s my save game 101:

But isn’t game instance just called once when the game starts, and never reset until game is closed?

That’s right ( sorry, think we’re talking at cross purposes… ).

Ok, I managed to set the condition in the game instance with the does save game exist and get rid of the “accessed none” errors I got when using it, I had to use the “validated get” node for the savegame file references.

It seemed ok for a while, but then it started to randomly overwrite data between slots again… I don’t know what to say anymore, it doesn’t make any sense.

I think you have to cut it back to basics. Just get one part working, then add another part etc.