Saving and loading locations and properties of objects while being in editor. How to do?

Hello and thanks for reading!

I am using UE5 to create sort of virtual production environments. Thus I am building scenes with meshes and lights and so on, an now I want to rearrange all elements to predefined positions and rotations with one click. This way I want to have several different “scenes” but all with the same elements in it. Also, the lights should be able to be switched in groups on and off on demand.

I could do that with the sequencer, keyframe all I need and then jump to the positions I need. But this is too clumsy, so I want to have an editor widget and store all elements at once to a file, being able to restore everything by reading this file later on.

Now I wonder how to do that. Is there a system or plugin to cover such thing? Or should I write everything to a text file using custom structures via Blueprint? Or could I use the “SaveGame” class for this, even when never playing?

Sorry for maybe asking a dull question, I am still a newbie…

Thank you very much!

1 Like

You can use the save game from the editor :slight_smile:

It’s totally possible to write a kind of ‘central control’ blueprint ( or editor widget ) that updates things and uses the save game for this.

use any free plugin to edit text files or do it in c++. Or use savegame as wrote above

Ok, thank you very much!

Now, since I am an absolute newbie with BluePrints, please excuse me taking this thread as an opportunity for further learning.

I now created a widget, succeeded getting a list of all actors within a level and also inherited my own BP_SaveGame from the “save game” class.
I also created a structure that can hold a transform and a memberID as a string, like “directionallight_0” or so. This naming convention seems to be the system for identifying a unique actor in the level, right?

Now I want to serialize all the transforms together with the memberID-string.

Would you say, that this is a good approach or would you have chosen another? and if so, why?

Thank you so much!

Martin.

Now, I succeeded saving and recalling all actors transforms in a level using the SaveGame class.

However, if anyone ever stumbles upon this post again, one thing might be of interest:

Although the class “Actor” pretend to serializable via SaveGame-Class, it does NOT really serialize!

So one has to to serialize property-members manually, it is not possible to save an actor with all its properties right out of the box, unfortunately.

That’s a pitty, as discussed here too.

However, thank you very much.

1 Like

The ending will let you put a actor reference in the save game, but it doesn’t mean anything of course because it’s a dynamic ( runtime ) thing.

Also, saving a reference will not save anything else associated with that reference ( as you discovered I think ).

Well, the member-variables of objects are more or less static. Thus it would be able to serialize the state of an object.

If I unterstand right, Unity provides this:

Serializing objects in JSON

I did not check it out, but here is or was an approach, and there is also a thread here in the forum, discussing the topic. Can’t find it right now.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.