I’ve been trying to remove some triangles from my static mesh like this
UStaticMesh* Mesh;
UStaticMeshDescription* SMDesc = Mesh->CreateStaticMeshDescription();
SMDesc->SetMeshDescription(*Mesh->GetMeshDescription(0));
TArray<FTriangleID> TrianglesToDelete;
//fill triangles to delete
SMDesc->GetMeshDescription().DeleteTriangles(TrianglesToDelete);
FElementIDRemappings Remappings;
SMDesc->GetMeshDescription().Compact(Remappings);
TArray<UStaticMeshDescription*> Arr;
Arr.Add(SMDesc);
Mesh->BuildFromStaticMeshDescriptions(Arr);
Mesh->Build();
return TrianglesToDelete.Num();
I need to call Build
on my mesh or else vertex painting and UV channels go to hell. The problem is that when I restart the editor the mesh is unbuild and needs to be built again which resets my lightning data etc. Is there a way to save the state of the mesh after calling Build
permanently?