Save and load placed Actors in the Editor
I have a level consisting of a road and a few vehicles (which are blueprint assets that I created). I'd like to create different traffic scenarios by putting vehicles in different positions and setting their variables, without creating a separate level for each scenario. Inside the editor, how can I save a set of placed actors to a file (or directory), and load them to the level later based on which scenario I want to work with?
asked Sep 17 '18 at 03:26 PM in Using UE4
You have a couple of options, depending on what you want to achieve.
In practice, you would create a struct for each traffic scenario. Each traffic scenario struct would contain arrays of other structs relating to vehicles present, their state, road layout, conditions and any other variables you may need. You can create this data in a worksheet (anything that can export a *.csv file) or directly in the editor.
In this case, rather than holding rows of DataTable structs, you would position your vehicles around the map, set their variables, run the project and save the state of the vehicles to a Save Game Slot by name. This will need to be done in loops. Rinse, repeat and save a different layout, this time round to a different slot. You can then load a save game from a slot and respawn everything.
Save Game Object would work for both scenarios, of course. DataTable allows you to tweak a lot of variables quickly (especially if you do in excel) but the ability to set everything visually in the viewport has its advantages as you can imagine.
Follow this question
Once you sign in you will be able to subscribe for any updates here