CreateAndSetMaterialInstanceConstant() overwriting LOD materials

On certain static meshes in my game, when they are initialized, I create and set material instance constants for each of the materials on the mesh (so i can apply damage params to the materials via UnrealScript).



simulated function PreBeginPlay()
{  
    for (i=0; i<Mesh.GetNumElements(); i++) {
        Mesh.CreateAndSetMaterialInstanceConstant(i);
    }
    ...
}


The trouble I’m having, is that this also sets these materials on the each of the lods for this mesh. This can be highly undesirable as the lod may be using different materials altogether.

Does anyone know how to get around this problem? Thanks in advance.

Same problem and still no solution found…
https://forums.unrealengine.com/showthread.php?137092-Set-material-to-mesh-s-LOD

I have added a distance check to materials to remove effects I don’t want to get processed from far away. It uses If node to toggle them, and I have no idea if it optimizes anything or not.

that only makes things slower :wink:

‘If’ is not a true branch, so everything you connect gets processed

So, the only way is to use StaticSwitch? Which of course is static.
Any way to access LODInfo of the static mesh?