Hi, I have been trying to save my Dynamic mesh components at runtime but with some luck.
I have been reading Gradient Space http://www.gradientspace.com/ by Ryan Schmidt and he writes:
“However by default the UDynamicMeshComponent will create it’s own UDynamicMesh instance, and it will be serialized “with the Component”, which means it is stored “in the level”. I will cover this in depth in future Tutorials.”
I have managed to load a dynamic mesh from a saved game slot but none of the runtime changes to the mesh are included. For example if a do a boolean operation on the mesh (and save) it is not included the next time I load the actor/component/dynamicMesh.
I would appreciate all tips you can give me and I know it is still experimental.
I am using blueprints at the moment but I can jump to c++ if it is needed.
Really looking forward to the 5.1 release and especially that updating physics is async.
Btw i just ended up saving the whole level. Using sublevels and loading them dynamically. sucks but works, and in the end it kinda organizes the loading chunks.
i can’t share screens sorry. as you might have noticed is not a obvious task, it took me a while to figure it out.
for loading it i resorted to ULevelStreamingDynamic::LoadLevelInstance(
you could also add them to the " Levels" panel window and use that with UGameplayStatics::LoadStreamLevel(World, LevelName . but loadlevelinstance will allow you to instantiate multiple of the same levels. it does comes with its own caveats (specially on unloading )
i’ve managed to unload consistently by using UGameplayStatics::UnloadStreamLevelBySoftObjectPtr(GetWorld(), MyLevel
If you can get away with manually created levels, and using them only once. then i would recommend you to use the levels tab and the streamlevel system.
If you need to instance them, you should use LoadLeveInstance.
if you need to create the levels programmatically, you can use this.
the ONLY way i found for " saving" a new level was
start with a template level
duplicated it (that’s the only way i found)
it will create a new object (unless you tell it to not overwrite). it will remain in memory until you literally " save it" (probably with the asset manager. i didnt needed/nor wanted to do this.)
you can check if the level already exists using the FAssetRegistryModule
there are a lot of UWorld as you can tell. the “level” asset in ue afaik is handled via the world object. when you load an instance it’s like the level gets detached from its world and added to the parent one but the level needs to be contained in a world (or something like that im not sure).
this only work on editor. so you need to put it in a module that only runs on editor mode. (or use ifdefs which i don’t like much).
there are other things like landscapes and navmeshes which i only could properly serialize through adding them to this new level (as opposed to serialize regardless of any level).
I am using blueprints at the moment but I can jump to c++ if it is needed.
i wouldn’t think this is exposed to bps but haven’t really tried.