How can I save map at runtime in Blueprints?

I have a problem, guys. I made a building system wich works pretty well, but how can I save the map in blueprints at runtime? Keep in mind that the objects are placed at runtime in the world and they are not already placed. So, I don’t do anything if I save their location. Please, help!

You need to make a Save Game for this case. Create a struct with the world transform and the actor type and everything else you need. When you want to save your map, you need to fill an array in your Save Game with these structs and save it.

To load the map you need to load the Save Game on start and spawn the actors according to the array you got from your Save Game.

They should also save the name of the level they want to save as a string in the Save Game. Use the Get Current Level Name node to get the value.

Or use the Level name as the name for the Save Game, so you always can check for every Level if a Save Game exists and if yes, load it automatically without the need to specify a Name for each Level.

Thanks a lot guys! I will try that and I will let you know.

I tried what you said, but I got stuck at the part with spawning them.
Can you explain a little more in detail? Bucause the Spawn Actor from class node spawns one object type. And if I place two or more objects using my building system…it won’t work. Can you make a test project of what you meant and send it to me, please? And don’t do a complex building system because that’s not the point. Just make a line trace by channel and spawn a cube at the impact point of the line trace. Thanks! :slight_smile:

were you able to save the whole map?

Can Someone please create an easy demo and send it here? Or just the blueprints ss how they are doing it. Please help me out :pray:

You could implement it in the following way:

  1. Create a structure to keep actor properties needed to save.

You can add other data to this structure, such as a static mesh, materials, etc.

  1. Create a save game object blueprint and add some variables and functions.

image
image
image
image

  1. Create a SaveActor recursive function

  1. Save Event

  1. Create RestoreActor recursive function

  1. Restore Event

  1. Add an “Ignored” tag to actors in your level to ignore them while saving.

Similarly, I implemented the saving of scenes in my editor:

Example Project UE5 (Contains blueprints from this post)

1 Like