How do i save actors?

Take a look at SaveGame.

  1. You will have to save it into a game file
  2. When the map loads, you load the savegame and spawn new actors from the information
1 Like

i want to save actors that spawned in game in after i close the game like you can save vars i want him to stay there how do i do this ?

and save the vars in him

i know about save game but how do i do this this with an actor

You should not save spawned objects.

Instead, save details about those objects (transform, health, object class). Then, when you load a game and you load the level, simply spawn the actor from the class at the transform and apply all the modified variables to it.

i know this my question is how do i do it i dont know how to do it

I recommend following a tutorial for SaveGame to see how to save data in a save game object.

From there, you can create your own save game objects with the variables you need based off of your game actors.

For example, let’s assume you have created a blueprint actor and called it BP_Actor. This BP_Actor has a variable bool called MyBool.

When you create a SaveGame object, you could add two variables to it, a bool and a BP_Actor class variable.

When you call the save game function somewhere in your game, you would grab the value of your BP_Actor’s class and its MyBool into the savegame object.

Then when you call the LoadGame from slot function, simply spawn that BP_Actor class and after spawn, assign the status of MyBool to the save game object’s version of that variable.

This is just a simple example of things you can do with a savegame object, as long as you understand the basics, you can expand on this and store that object’s transform and various other data only variables.

1 Like