How to Edit Layer Parameters for MaterialInstanceConstant in UE5.5 Using C++

Hi Sam,

Thanks for your kind replay. I just solved the problem 2 days ago. The validation occurs in the function void FMaterialLayersFunctions::Validate(const FMaterialLayersFunctionsRuntimeData& Runtime, const FMaterialLayersFunctionsEditorOnlyData& EditorOnly).

The check condition that stops me is

check(Runtime.Layers.Num() == EditorOnly.LayerStates.Num());

The AppendBlendedLayer function creates new layers in EditorOnly data as well as RunTime data. But I tried to add layers in LayersRuntime at the same time, resulting in inconsistency between EditorOnly Data and Runtime Data.

LayersRuntime.Blends.Add(BlendLayer); LayersRuntime.Layers.Add(BaseLayer); LayersValue.AddDefaultBackgroundLayer(); LayersValue.AppendBlendedLayer(); NewMIC->SetMaterialLayers(LayersValue);This is what works.

LayersValue.AddDefaultBackgroundLayer(); LayersValue.AppendBlendedLayer(); LayersRuntime.Blends[0]=BlendLayer; LayersRuntime.Layers[1]=BaseLayer; NewMIC->SetMaterialLayers(LayersValue);Thanks for your reply and the UDN threads you provided though.

Best,

Roland