How to use less "set material" nodes?

So i’m trying to make a building system and the part where it has to set the material for the ghost color, It only set one of the parts out of the 20 that was there, I fixed it by using 20 “set material” nodes but that just looks messy. Any way to decrease the amount of these?

Make array variable of all buildings(, if you need use “for each” node to set all of them to normal material, randomize number between 0 to 19 (or do whatever condition you want), read building from that index. here you have example but i used pawn class as example:

I did something extra i made it randomize between 0 and size of array, 2nd i don’t think you need setting material for all buildings, just make blueprint with already set material :slight_smile: But i don’t know what you trying to make so ;p

Yo, i dont know if it’s what you need but you can set all materials of one object by using “Get materials” and then “ForEachLoop” (For each Material), you can “Set material”. This will basically get all the materials of the Mesh and then applying the Material you need to all of them.

Im trying to make the building system correct?, I started with a campfire object and when I tryed to see if I could not place it, only one of the rocks was green/red, thats when I did the set up with like 20 set materials. And can you explain what you did more? Like what type of array that is? etc;