Actors saved in Save Game object seem to be destroyed on opening a new level

I’m having an issue with saving character settings. In order to encapsulate the player settings, I created an actor to hold nothing but all the player related setting I wanted to save. I spawned that actor, assigned it to a variable in the save game object, and then saved it.

My problem is, when I open a new level, when I try to access my data actor, I’m coming up with errors because the player settings actor is now null.

What I’m assuming is happening is that the save game object is simply saving a reference to my player data actor, rather than the actual actor itself. As a result, when I open a new level, the player settings actor is destroyed, leaving the reference inside my save game object pointing to nothing.

Does anybody know if this is the case? Also, is there any good way to encapsulate player settings into an object that won’t be destroyed between levels? Putting everything at the root level seems messy, especially because I’m using the save game object to save the data for multiple local players.

You are indeed correct. Actors are elements of the level and will be destroyed when you try to change the level.

The ideal case would be a simple object which one can use to store variables. Sadly it’s impossible via blueprint right now to spawn a simple object so the only “fix” I found was using a savegame. That sounds worse than it actually is. Those have incredible performance and are quite good to use. Not ideal but it works.

Cheers! :slight_smile:

PS: If anyone knows a better way… I’d be more than interested in that!

Are you saying that you put save game objects as variables inside a save game object? That sounds like a pretty clever thing to do, but it still doesn’t seem to work for me. I just get a null object error when trying to access that variable from the saved game.

Are you sure you load and save it properly?

Could you post an image or something?

I’m beginning to think that I may have misunderstood you.

I made a blank 3rd person template project to test this out. The first image is my save game setup in the level blueprint. I attempt to create a primary save game object, then create another save game object to store inside that primary save game object.

In the second image, after loading the level, I’m accessing the primary save game object. That part works fine. But when I try to access the save game object stored inside the primary save game object, I receive an error on exiting the editor, and can’t access any variables stored inside it.

However, if I don’t open a new level, I can access those properties just fine.

You never saved your sub savegame.

Thanks for your help, I really appreciate it, but could you maybe show an example of what you mean? I’m not very clear on what you’re suggesting.

As an alternative solution, I’ve just saved separate save game objects for each player, rather than encapsulating them in one single save game object.