Wrapping materials in a parent material during runtime

During runtime in Unreal I want to be able to apply opacity fades to any Actor in the map. Each actor can have one or more material slots on the mesh (static or skeletal).

Is there a way during runtime to edit each material slot on a mesh and create a parent material of the current material being used?

For example, I might have a humanoid character with multiple material slots I want to fade in/out. For each material slot I’ll wrap the current material as a child of a custom parent material and then set the opacity on the parent material. The existing child material is still being applied, but the opacity is being overridden by the parent material.

All this has to be done at runtime. Doing it ahead of time in the editor or maya is not an option.

What would be the best approach?

You’ll want a Material Parameter Collection, which is basically an external parameter that can be modified via code, BP, etc. So you would have that parameter in all of your materials connected to opacity, and then you would just modify the value of that single parameter. It should update everything using it all together