how do I save actors spawned into the level and the load them

it looks to me like your saving the locations and maybe even a reference to them, but that won’t help if your loading or reloading the level. when you load the level it is as if the cubes never existed because in this instance of the level they never have. when a level is exited then everything in it is destroyed including your cubes. think of everything you make as a blueprint (real life blueprint to build something) that tells how to make the item, then you create a house from that one blueprint, you then add furniture to the house, and finally you destroy your house and build another. would house two have furniture? nope.

so then how do we fix this. you have the basic info of the actors you want to exist in the level. you know its a cube and you know its location. so all you need to do is to spawn it into the level. to do this you need a event that says we’ve loaded the level so now we will spawn the cubes, lets go with on begin play of the level for simplicity. so on begin play we get the save data, get locations and classes to spawn, then we run some loops to spawn the cubes. the psudo code would be like this:

  1. on begin play
  2. load save data
  3. get locations array
  4. for each location (this will run the loop once for every element in the array)
  5. spawn actor of class (set location based on array element)

theres a million other locations you could run the script and theres merits to each, theres also modifications you can make to the script itself to accommodate different actor types.

I’m making a building system for the player my problem is that the cube actor in spawning won’t save and load when I go back in it acts as if I haven’t even spawned it

I’ve tried saving it like this and using arrays

so would I have a spawn actor component at begin play and load its location

i mean it depends on what kind of actor but basically yes thats what my post was saying. you spawn then the thing then set its location.

Ok I got it I’m saving the level actor under the player or the level blue print and it works

uhhh what? i guessing that your saying you are storing information about the actors (cube) in the player or level bp which wouldn’t work for getting information when loading a new level. but then again its not really clear what your attempting to say. then again if it works for you then congrats.