Loading Savegame Blueprints

Hello everyone, I started at the beginning of the year with the Unrealengine 5 and am anything but experienced. Last weekend I started to extend my save game for blueprints within the level, at least I tried. Also, unfortunately I could not find any answers in the forum. I hope you can give me a hint what I am doing wrong.

Initial situation:
Started with the Save Game asset of UE5 in which all information should be stored:
grafik

After the start of the game (event Begin Play in Charakter Blueprint) everything is loaded. This works without problems with the player position, and both structures for the player inventory.

I am creating the save game Object in a “Pause Menu” widget (Player Positions and Inventory System works fine)
My first attempt to save the blueprints (like stones and wood that should change position after interacting with them) in the game and load them after the start of the game:

Target Savegame is set in the Charakter Blueprint to → BP Save, and I cast the BP Save from my Player Charakter in the “Pause Menu” widget
→ Saving all Actors with Tag “Save”

Loading:

After Loading Player Position and Inventory from my Savegame

  1. → Delete all Actors with Tag “Save”
  2. → Try to spawn all actors with Tag “Save” from my Savegame

Result:

All Actors with Tag Save are destroyed, nothing spawns.
Now for the interesting part:

If I dont destroy all actors with Tag save in the first sequence →
The blueprints that were untouched in the game before the savegame (like stones) spawn twice and the blueprints that my character picked up spawn at the intended position like in a new game (as it should be without destroying the actor in the first sequence).

According to my understanding, if all saved Actors are removed before, it should actually work.

After I read in the forum, that only the relevant information like location and rotation should be saved, I tried to solve it with a Struct (not working, only an example):
Save example:

Array of all Actors with Tag

Load example:

Yeah that didnt work. (also with the right connections)

The basic save and load works as said (Player position, Inventory structs)
I would be very grateful for a tip, maybe also with an example?
Maybe I am completely wrong?
Unfortunately I only have time for this extremely interesting hobby on weekends and probably can’t answer immediately.

Thank you!

My strategy for this is that in my level blueprint begin play I test if there is a saved game and, if there is I spawn what has been saved.
If there is not a saved game I spawn actors in the default positions.
I do not have anything that will be saved and loaded placed in the level and hence I do not have to destroy anything.
It works for me.
cheers
Podge.

1 Like

Podge, thanks for your reply.
It´s working now. Changed the check for Save, and spawn actor to the level blueprint (makes sense I think).
Key to success in my case is a Struct.


Struct Variables

grafik
Struct in my Save


All Actors with Tag Save to an array → Target is Save Struct in my Save


In my Level BP I destroy the “saved” actors


Last step is spawning all Actors from my Save Struct

Error of mine was not to set the “Set Array Elem” during the save operation.
And now stones, ores etc. are spawned with the appropriate tag at the correct position.