Hello! I’m trying to bake skeletal mesh at runtime in order to reduce UMorphTargets UObject-s in memory. Now I have two experience options:
1 - First one is when after baking, I directly try to destroy Morphs by “ConditionalBeginDestroy” method and remove them from array. As a result, I remove morphs from memory, but sometimes I get a crash: FMorphTargetVertexInfoBuffers::InitRHI stage.
2 - Second one is when after baking, I just call “UnregisterAllMorphTarget”, nothing crashing, but “memreport” show me that any of morphs was not unloaded and still in a memory.
Notes:
-
before changing vertex, I duplicate a SkeletalMesh that I want to bake and called “ReleaseResources”;
-
after changing vertex, I called “InitResources” and “PostLoad”;
-
for changing vertex, I don’t divide the vertices into sections and immediately take the vertex by index;
(LOD.StaticVertexBuffers.PositionVertexBuffer.VertexPosition(VertIndex) = Vertex.Position;) -
the logic of changing the vertex is almost the same as in SkeletalRenderCPUSking.cpp(SkinVerices), except for division into sections.
I will be glad if someone can help me in this matter