Group variables in blueprint


I am following this video tutorial: Intro to Materials: Dynamic Material Instances cont. | 10 | v4.0 Tutorial Series | Unreal Engine - YouTube to change parameters of a dynamic material on a mesh during runtime. The problem is that my model is splitted up into different meshes to get better lightmap quality. I have added all meshes as variables in the blueprint but I cannot connect more than one variable into the “create dynamic material instance” node. Doing separate identical blueprints for every meshpart would solve the issue but seems to me like a dumb way to solve it, I would like to kind of group them all together. Can I add all meshpart variables to an array or something like that and connect the array into changing the dynamic material instances?

I don’t understand.
If each mesh uses a different material, Then each one needs it’s own dynamic instance.
But if they use the same material, You can just set them all to the same one.


I would add them all to an array and then use a for each loop to make the MIDs for them all. Then I would add all the MIDs to an MID array and anytime you need to set MID settings, you loop over that array too.

Under the hood, what UE4 does is loop through all objects connected to the function node target pin and call the function for each of them, so of course this is only possible for functions that don’t have output pins, because N input objects mean N return values.

(Maybe this feature could be improved by turning the return pins into arrays when multiple objects are connected.)

Thank you very much for the replies guys! I was actually going for RyanB`s approach but in the end I solved it globally in the level blueprint with Material parameter collections