UE5 save game not saving all data

Here is the problem: I am trying to save stuff in a save game file, but I noticed that UE5 only saves my variables if I actually change them. It doesn’t put them into the save file with default values. I don’t know if it’s trying to be helpful, but it’s not helping. Not only that, I tried saving arrays of structs that are only 2 integers, but it doesn’t save any type of array in general. Am i doing something wrong here? All of these variables below are inside the SaveGame Blueprint, and they all have the SaveGame option enabled and they are instance editable. I haven’t enabled or changed any save game settings in project settings and I don’t have any plugins for this. Even if these variables only have a default value, I wish them to be in the file at first creation/load. Thanks in advance!

You shouldn’t need to store any game settings within a save game file as Unreal Engine already has a base class for game settings. This base class includes all the game setting you’re trying to save except UseLan so you would have to sub-class the game settings class and add functionality for UseLan.

Arrays do work in save game objects but they have to go through a for each loop so the data from your game instance or other blueprint actors carry over to the save game.

You shouldn’t be assigning any default values to save game objects. It’s doesn’t actually save any default values because it’s not built to work like that.

Thanks for letting me know, I will move some of the variables from the save game to another one. I tried many solutions, but no matter how I try to save the array into the SaveGame, it does not work. Here are some things I tried:

  • Using Make Array, and then setting it and right away saving it.
  • Using For Each Loop to set the array to itself from from the same source that goes into the for each loop. I don’t use the array element, just set and save.
  • I tried to resize the array
  • Neither AddUnique or Add had any effect
  • I tried the same with a string array, still nothing

Though, what I noticed, single variables like one integer variable, not an array, gets saved. But an array of it doesn’t. All of the variables in save game are set to save game enabled and instance editable. I am specifically trying to save my array of structs of two integers. Also, Interestingly, I got it one time to work using make arrays, but that doesn’t work anymore. I tried deleting the save game folder and it’s contents, deleting DerivedDataCache, Saved and Intermediate, but nothing. I will keep trying to find a solution in the meantime. If anyone can help, I greatly appriciate it! Thanks in advance!

Ah! I found the solution! I don’t know why, but I in my desperate tries I turned of all:

  • Expose to Spawn
  • Instance Editable
  • Transistent

I do not know which one, but now the array gets saved correctly inside the SAV file! :smiley:

Edit: I think the problem was that I didn’t know what Transient meant. I thought it meant that the value of it won’t be lost when changing levels, but now I looked after it and it’s something totally different!