CreateSaveGameObject Question

I am creating a save game object as class name “Blueprint”.and casting it to “Blueprint”.

I then connect it to a SaveGameToSlot node with the save name “save”

How is this viewable inside “Blueprint”?

i.e. I want to store data inside this “Blueprint” but no object appears after the save event is called.

So for example, lets save and load your health, you would start by creating a variable in the save game blueprint called something like “saved health” and then whenever your character dies, you would cast to your save game object and send your characters health variable to the save health variable, then on your characters begin play, you would load the save health from your save game blueprint and set it to your charavters health

I can’t cast my Struct (which holds my two variables) to savegame blueprint, “New Blueprint”. It needs an object but struct cannot connect to object/interface.

Here is the whole blueprint, what am I doing wrong?

My “Saved Inventory” variable of type struct is inside my savegame blueprint (the whole savegame blueprint is empty besides that one variable) and it has the same inputs as “Inventory” inside the actor blueprint that properly gets values from the level blueprint thru event Store.

When you load your game you have to again set the loaded game file to the save game object so it can be further used, im sorry if this isnt the question you were asking im having trouble understanding what your trying to accomplish
In your case you will have to make another save game object refrence in your level blueprint and set the loaded save slot to that object

I would try to either,

  1. Instead of creating the save file in your other blueprint, drag off the false node in your level blueprint and create the save there.

And if that doesnt work i would also make sure that your saved variable is marked as public

I have this in my level bp to load a game

My values that I want to save are being received and set to a struct, Inventory. Then in that bp that has SaveGame, LoadGame, and Store (store is receiving the struct), I am confused as to what to do with those values that are received, coming from event Store. My SaveGame does not occur because when I load a game, nothing happens. No stored values are brought out.

For my Inventory Struct there is a check box on the right hand side for SaveGame: “Should this variable be serialized for saved games?”
Private remains unchecked.

When you say, “set the loaded game file to the save game object”, does that mean I will have to cast to NewBlueprint for this node?:

How should I alter my blueprint then?

If I want to save my game from the level blueprint, do I get the Inventory, plug it into SetInventory (which is in savegame blueprint, “New Blueprint”) and then SaveGameToSlot?

My SaveGameReference has a value of none:

I think my problem is Inventory isn’t setting its two Int values CT and ST to be added to SavedInventory two Int values CT and ST

That’s why I’m printing the values but the values keep remaining the same.

I clicked the eye and wrote in the slot name.

With most nodes already in the level blueprint can I delete my blueprint that holds the events SaveGame, LoadGame, and Store?

My only question is how I can get Inventory variables to keep adding to SavedInventory variables, and get SavedInventory variables so I can print them.

I printed from doesSaveGameExist->True && ->False and got different messages for each one, so I know my game is capable of CreateSaveGameObject and LoadGameFromSlot, along with SaveGameToSlot. Thank you for help with that!

Once you have loaded the game you must set the save game object in your level blueprint exactly like you do when you create the save game, i also suggest clicking the eyeball next to your inventory variable in the same game blueprint, it marks the variable as “editable”

Also at the end of your create save game file in your level blueprint you forgot to put in a save game slot name

Yes you should remove any saving and loading inside the save game variable, and only save things inside the blueprints you wish to have variables saved and loaded, how are things working did you get your variables to save and load? If not maybe you should right print strings that say “failed” in areas that you feel may be incorrect, it helps to diagnose where the problem happens

Try dragging off the inventory variable and clicking “make struct” and do the same for savedinventory and click “break struct” and hook the nodes up when loading your game in the level blue print

And if that doesnt work, trying using the “event level reset” event and saving your variables off it, it will save them everytime the map has to reload

Yes so instead of setting it to inventory directly, pull off from the node set saved inventory and the option to break struct will be there and do the same for inventory

Yes that is exactly what you need to do! Im so happy your understanding it because the first time i tried to save and load variables i had a headache from it haha it is so confusing at first

I got everything just am unsure of how to get SavedInventory to stack (add) the values that Inventory keeps giving it every play and exit of the game → wanting to print those.

I can’t access SavedInventory since it is only in savegame blueprint, “New Blueprint”.

I only had SavedInvetory set because I got it from a CastToNewBlueprint node, where the LoadGameFromSlot had the return value for the object of the CastToNewBlueprint.

Well I have my two variables that I want to keep adding to the SavedInventory variables