Hi, I’m making a VR base-builder game where the player stands in a room and gives orders to robots. I would like to make a procedurally generated map in front of the player that he/she can move around and scale, but the problem is that there are hundreds of materials that are supposed to be on the map, and I’d like to mask all of them to a box without editing every single material. What I have so far is a BP function that replaces the material with a newly generated masked one of the same colour. The problem with that is I can’t then “copy” over other parts of the material, like metallic or specular.
It’s hard to say exactly what you are after, but I’ll try to help.
In your blueprint take a reference to the map (mesh I assume?) and drag off a get number of materials node. Then make a for-loop and plug in the number of materials minus 1 as the last index. So the for loop should iterate from 0 to the number of materials (minus one because the index element starts at 0).
Now you can create dynamic material instance for each and every material in the loop. What I would do also is make a variable called something like “MaterialsArray” and make it an array of dynamic material instances. In the loop, after making each dynamic material, you want to add that material to your array.
Now you will have an array of all those materials so you can reference them however you need.
Hopefully you follow and hopefully this helps your issue.