Saving variables in a blueprint to a save game slot

I know how to do a basic save game…but I’m scratching my head trying to figure this one out:
I have a level where the player can click a button on the map to spawn a “camera location” blueprint. In that blueprint are two variable: Actor Transform and Name.
We place a few preset camera views in the scene, but the player can set new views too. So, the player can roam around the level and add custom views. This spawns the “camera location” blueprint and adds it to the array of preset cameras. It adds an icon to the map and the player can click the map icon to return tho those views. This works like a charm.

However, I want to save those user views to a save game. In my character BP, I have the “camera location” blueprint array save to a slot. The actor references save, but not the transform or name inside the actors. Does the save game not store the variables within the actors I’m saving?

Any advice?

How the ‘SaveGame’ system works:

You create a SaveGame object.
Inside you add “mirror” variables of values you need to save.
Copy “real” values to mirror values then write the SaveGame object to disk.

You have to copy each variable manually.
Trying to save Objects or Object Reference won’t work, Unreal will just ignore you there.

Only “primitive” value types are supported by the built-in system (int, float, vector, struct, etc).

Again: objects will NOT save*. (Epic must clarify this in their docs).

  • In my Savior2 plugin saving Actor References, Sets or Maps of Actor References does work tho :wink:

If I’m getting this right…

All I I need to do is create mirror variables of the ones I need saved . When I trigger the save simply update the mirror variables according to the real ones?

What? Dude I’ve been stuck in this for almost 2 days now, I’m trying to save around 70 variables and none are saving, NOT EVEN 1!
I create game save object, I’d change the bool for example to true and then save node function, IT DOES NOT SAVE! FSFS HELP ME

Show us how you doing it.

each variable you want to save, must exist at least twice.

One in the Savegame Object, and one, where ever you want to change it.

You create your Savegame in a persistent place, like inside a GameInstance, via CreateSavegameObject AND store this Object as Variable INSIDE your GameInstance.

When you change your bool in a widget, you need to pass the changed value to the Savegame Object and set the second bool in there…
This can now be done by using
Get Game Instance > Cast to Your One > Get Savegame Object > Setbool in object

AFTER THAT, you call Savegame To Slot and use the Savegame Object from the instance as pass in parameter.

when loading via Load Game from Slot, the Node returns a Savegame object. Simply set your GameInstance Savegame Object, to this Return.

Now you can Get your Savegame Object from the Instance again, and get the loaded values out of it.

1 Like

Here is a good video on the save game node that should help