See licensee description of the issue:

The problem appears when I have two instanced materials with the same number of parameters. I've noticed that ShaderMapId has MaterialLayersParameterIDs where all LayerIDs are set to 00000000-0000-0000-0000-000000000000. Because of this hash calculated as a DDC key is the same for both different materials and then both materials are using the same shader (which is incorrect). This happens because all StateIds for UMaterialFunctionInstance are initially set to 0 and are never properly generated. I can fix this when I recreate the guid for UMaterialFunctionInstance doing something like this:

void UMaterialFunctionInstance::PostLoad()
    // Here is my change
    if (!StateId.IsValid())
        StateId = FGuid::NewGuid();

    if (Parent)

or just set StateId = FGuid::NewGuid();

in a UMaterialFunctionInstance constructor.

Unfortunately, this causes a constant shader compiling during each editor restart. Maybe You guys already have a solution for this problem or can give me some hint on how to fix this properly?

Steps to Reproduce


Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-117285 in the post.

Login to Vote

ComponentUE - Rendering
Affects Versions4.26.24.27
Target Fix5.0
CreatedJun 3, 2021
ResolvedOct 14, 2021
UpdatedNov 30, 2021