PLEASE HELP!! Spawn All Actors From Save File

Hello and Happy New Year!

Watched a Youtube video on how to create a save actor file. It works but it does not show how to save all actors, just one actor. I played with it for to many hours to count and got the save all actors to work but cannot figure out how to get them all to spawn. If there is a tire, box and crate in the game level you can press the “K” key and it will successfully save all 3 to a save file.

You can then press “L” key to reload the save file and 3 boxes will appear. It should be tire, box, crate, but I cannot figure out what to add to the “Class” for the “Spawn Actor”. If you click the arrow and choose box, it will spawn all boxes, even if you had 10 tire, 10 crates it will be 20 boxes, or if you change the “Class” to tires, then it will spawn 20 tires.

Can you think of anything to try to get the Actor classes from the save file so they can spawn correctly?

Thank you,
John

SAVE FILE

Load game​​​​​​​

If the only properties you want to save / load are the type of actors / their position it’s quite easy to do:

Create a Blueprint Structure (right click, blueprint drop-down, structure).
image_126117.jpg

Give it 2 properties: Actor Class and Transform.
image_126120.jpg

Add an array of that structure to your save game.
image_126121.jpg

Add an array of Actor classes (this will be the classes you want to store). Be careful to pick “Class reference” and not “Object reference”. In the “Default Value” of that variable, choose the class you want to save. In the screenshots there are 3 entries “none”, specify your classes to save here. The “Saved Actor” is the structure you want to save / load.
6.jpg

Saving: Loop through the Actor classes, for each of them, get all actors of class, for each actor of class, add it to your Structure with its transform. Don’t forget to inject that information to your save game.
image_126118.jpg

Loading: loop through your array of Actor Class / Transform and spawn such class at desired transform.
image_126119.jpg

EDIT: I’m fighting against the attachment uploader =/

Hello Yun-Kun, thank you for the information! I see you have a YouTube channel for Tutorials, you should do one on saving all Actors in a level. There are only 2 video for this on YouTube and they are for saving only 1 actor. I could test the video for you :slight_smile:

I setup the Blueprint Structure and added the Actor Class and Transform, and also added the array of Actor classes to the save file. Now when I press the “K” key to create the save file nothing happens. I am probably not injecting your code correctly into the save file, do you have any advice, see screenshot below.

PS: There is not even a tutorial on the web for this, no where I could find information on this. There are so many people asking about this but no one seems to have a answer. What would really be nice is a step by step tutorial on how to create the whole save system from start to finish.

Yun-Kun, I played around with it today and was able to get it working perfectly with the code you posted.

Thank you, and if you are ever in the Dallas area look me up and I will buy you a beer!

Happy New Years, hope 2018 is amazing for you.

Hello there.

I’m glad you sorted it out!

Happy new year to you too and I will make sure to remember you when passing by Dallas :wink:

I always have tons of plan regarding tutorials but I never actually manage to pull one off. I’ll put that on my list.