Can you use a material instance in a material variable array?

Hi everyone,

I am trying to change materials on an Object using the “Set Material” function in blueprints.

When i manually select the material at the “Material” input I can choose from all the materials in my project folder.
This works but I have to make a seperate “Set Material” function for each material I want to include, which gets quite messy…

In a tutorial I saw that you can make an array variable and set the type to material - and use this variable to drive the “Material” input from the “Set Material” function.
I got this working but I can only add materials to the array that are not a Material Instance (so I can only choose from 15 materials instead of 50).

Is there a way to make a material array using all the materials in my project folder?

I am using version 4.19.2 btw

Thanks a lot!

Have you found a solution? I have the same problem.

Set variable type as: “material instance” like this:

Or like this “material instance dynamic” when you want to change instanced material parameters during runtime:

material-instance-b.jpg

This is grap about how to assign material and then change parameter value in material, all taken from array of instanced materials:

PS. When you have something referenced by name (like parameter name in material) it is best to make variable for this case str_Color_A, and set its value to “color_A” this way if some nodes get deleted you will not lose exact spelling of those name references, you simply reconect variables that contain properly spelled references. It is pita to debug those references when something does not work, so keep them in variables.

If you want to choose between Materials and Material Interfaces you have to choose Material Interface as a variable type

Screenshot-6.png

3 Likes