Setting material functions via c++

Hi, how do i set material functions (material attributes) via c++ during runtime? I could only set parameters like scalar, vector or texture for a material but didnt see set for material functions.
What i was trying to do is to blend two different materials together via material attributes. Since these two materials are pretty unique (lava, whirl pool…), changing basic scalar, vector or texture doesnt cut it.
Or is there another way to approach this. Any advice is appreciated. Thanks in advance.

You can’t change the nodes in materials at runtime - you can only change parameters of built materials. Materials are compiled to HLSL from those nodes, and this has to be done before they are used anywhere anyway.

The solution here would be to simply change the material that is applied to the surface using it.

Thanks for the advice. That was what i was afraid of. I have managed to work around the situation by tackling individual BaseColor, roughness … from the selected Material Attributes. It is not pretty and pretty heavy on the instructions.


There’s a material in the free Content Examples that does the same thing based on height map. Might be worth looking at.

Thanks. The rocket example in the content examples didnt allow material changes during runtime.