Saving an entire level with procedural objects created by the player?

I´m designing a mechanic for a game, in this case the player drops som objects to build an area (or maybe use a cut tool to slice a big box to define the volume he wants, it´s not defined).

In any case, the situation is that the objects in the level are created by the user procedurally, we create objects, and then children of those objects.

Is there a way to save the level status entirely so the user can save and load the level with the objects the player created intact?

Thanks!

Is it possible to loop over all of the items and store data like name, location, and children into a text file?

It doesn’t have to be a text file. I just used that as an example.

The problem is that the goemtry we have in the scene is procedural, for example, if we use slicing to cut a box in two pieces, how could I loop over that and save it? since it´s not an existing object in the assets…

Unless the slicing system was designed for that, you obviously won’t be able to save mesh info once dynamic Actor is gone.
If the runtime generated mesh is built in similar ways ppl do on OpenGL or DirectX then you could save all arrays of vertex/face/normal vectors to a csv file tho.
Then restore the object mesh later when loading back the game. that is a lot of work

You could try storing a set of instructions on how to get the finished result from the starting object.

Using those instructions, you could re-build a replica of the building in a different session.

It’s a little complicated, but it’s a complicated problem.

Thanks for the idea, maybe the slicing is not the best solution, the scene can be built from blueprinted objects, so maybe I can just save the positions in some way, just like Binkadin suggested, the idea is to save the current level state to reload it as it was when it was saved.

There is no “Save Level” function or something similar?

Cheers and thanks for the ideas!

there’s UEditorLoadingAndSavingUtils::SaveMap(World, Package->GetPathName());
and

bool FEditorFileUtils::SaveLevel(ULevel* Level, const FString& DefaultFilename, FString* OutSavedFilename )

(and its other versions)