It is possible to save objects in a save object

Im wanting to store all the player data into an object and then when the game loads, load the data from that slot and get the data. Problem is Unreal engine doesn’t seem to serialise objects in the way that I’m trying to do it any ideas.

This is the logic for creating the player save data if the loaded one doesnt exist. Problem is the save data is always invalid even when created

I’ve double checked before saving that the object is indeed valid but I still have the same issues

There isn’t an issue with the actual saving and loading because the save times are correct

During the load in the first example, if the loaded data doesn’t exist. You should save player data after constructing the new player data.

i tried that and am still getting the same issue, in the SaveGameObject theres a flag to allow a variable to be serialized specially for savegames but when I check it i still get the same issue?

New logic;

What prints are you getting? Also on the first branch after load player data, is it actually going to the true condition or is that resulting to false?

image
Its successfully loading the save data, I tested it by every time it saves I getting a random float and saving it as well and when I loaded the numbers was the same.

Here’s the full save and load script in case I missed something.

Loading;

Saving;

In the save player data function setting the “Local Save Object”, what are you doing with that data? If that’s indeed a “Local” variable, then I think it should be returned to the caller, because local variables get destroyed after they leave the “scope” of the function. Not sure that’s the problem but it’s the first thing that stands out to me.

Nevermind, I think the last image is the continuation of the one above it, sorry didn’t catch that at first.

Sorry I’m having an issue reading the images, they are very low resolution.

Its all good i would post them in a higher resolution but then id have to post multiple images of the same script

and yeah its the save script continued, otherwise it would be completely unreadable

Have you tried placing a breakpoint on the player data in various places?
Also on the Save Player Data function, you don’t have a connection to the Player Data input, is this intentional?

Yeah im grabbing a reference to the inputted data through a get, it works the exact same as plugging it in directly

I also tried a breakpoint and followed it step by step and nothing seems to be a the problem it just refuses to save the player object and load it in properly even though its set as a savegame var in the SaveObject. I might have to have a look on how do it in C++

If you have the means to do it via C++, I recommend it. It’s actually super easy in C++.
Just inherit your save game data class from the engine’s USaveGame class.
Add data members you want to store (they must be UPROPERTY’s).
Then use the functions on GameplayStatics to load and save your class.
Also look into the ULocalPlayerSaveGame if you’re needing to do anything per local player.

Okay I’ll have to have a good look as I’m not as familiar with C++, it’s a shame blueprints can’t do simple serialisation the way I wanted to ask it would make the engine so much more powerful