Hi. My code here is changing indices in RawMesh.FaceMaterialIndices but to no effect. That only seems to work for LOD0 and not the other ones. Any idea why?
bool modified = false;
FRawMesh mesh;
auto& sourceModel = staticMesh->SourceModels[lod];
sourceModel.RawMeshBulkData->LoadRawMesh(mesh);
auto& faceMaterialIndices = mesh.FaceMaterialIndices;
for (int32 F = faceMaterialIndices.Num() - 1; F != -1; F--)
{
if (faceMaterialIndices[F] == material)
{
faceMaterialIndices[F] = replacement;
modified = true;
}
}
if (modified == true)
{
sourceModel.RawMeshBulkData->SaveRawMesh(mesh);
staticMesh->Build();
}