How can I put different materials on the same blueprint actor?

I have a blueprint actor that contains a block. In the level I have placed the BP Actor around multiple times. However I need each of the blocks to have a different material on them. Each block has an assigned number to it. What would be the easiest way to apply the different materials? Ex: I have 6 blocks. Numbered: 3, 4, 7, 6, 2, 8 using a Integer Variable in the blueprint. I need to assign materials that say their correct numbers on the block.

Hello,
Maybe something like this?

Basically it sets the material based which number is assigned as Id. If the number is not the one you specified (used the same ones as you) set to base material (concrete for me). I would set it to something that will draw attention so in case of an error (not assigning id) it will be easy to spot.

1 Like

DonBusso’s way would work but I have a much simpler way for you to use.

(Optional) Create an enumeration by right clicking and going to blueprints → enumerations, name it then open it.

Click new in the upper right corner and fill in the name for the material you want to use. (It can be whatever its just a name just so long as you know what it means) Then do one for each material you want, save and close that out.

(Actual BP Steps) In your BP construction script right click and look for (literal enum “your enumeration name”) and click on it.

Now promote the left pin to a variable name it and make it public, then delete the literal enum from above

Drag in the Static Mesh you wish to change the material on, drag off and get a set material node

Promote the material pin to a variable

Now drag the set material node, the static mesh ref and the new material variable to the side a bit

ALT-drag and drop in another material ref (from what you just created) and hook that up between you construction start and the set material node.

Now off that enum var ref from earlier grab a select node and hook that to the set material node

Now fill in all those values with the matching material

Back in the editor now you can drag in that BP and in the details panel you can select the material you want to use from that public enum variable.

Conversely if you just want to use your int simply put in a switch on int node create all the pins you need and set the material var to each matching value you desire and then link all those to your set material node.