How to use dynamic material instance on multiple meshes

Hi there, I am trying to apply a material instance to multiple static meshes. Im new to blueprinting and get very confused by it haha.

But let me sort of break it down a bit, I have faked an effect with a breaker box and then i inserted small cubes with an emissive material that will in theory change from green to red (since im playing on the effect of the player “shutting off” the breaker box)

So I have got it set up right for one mesh but I am struggling to figure out how to apply that to multiple meshes- ill try and show through this image

so this is before the player touches the trigger

and here is after the player touches the player

if it matters, here is how i have it set up


hopefully someone undestands what i am trying to do here :slight_smile:

You didn’t set the material

In any event, I think you’ll find it MUCH easier if you make one light blueprint. Then all you have to do it drag 4 of them into the scene :slight_smile:

Ok I set the source material and the light does change but alas it is still only one of the meshes.

To make a light blueprint- do I just make a pawn actor BP, add the mesh and the material?
I then tried to reference the light BP into the Create Dynamic Material Instance target but couldnt.

Sorry if these are silly questions, blue printing is a foreign language to me!!!

You put everything you need into the button BP ( actor )

Then, to make 4 is just drag and drop

image

Then I did this ( just demonstration )

green

No fiddly level BP stuff.

If you try and do it from the level BP, you need an array of 4 instances for the switches and 4 for the lights. Pain in the bum.

Thank you very much, I set up the light BP and got it to change when stepping into the trigger. After confirming that it worked I then duplicated the BP around to act as multiple lights- and then once again only one light changed colors.

I must be setting something up wrong. While its not a huge deal as I can get away with just changing the color on one of the meshes, I just thought that it would be nice to change it on all of them

How does the switch work, you overlap with a collision volume?

Assuming you have 4 switches, you need to make a switch BP, copy it 4 times, and tell each one of them which light they are talking to.

Or is the switch part of the light? ( I don’t quite get the setup ).

Or do you just want them all to come on at once?..

Let me try and explain this all as best I can haha

So Im in school making a small exploration game. Your job as the player is to a few breaker boxes, but for the sake of simplification of just getting one of these to work, well call it one breaker box.

The player walks to up the breaker and there is a trigger volume which is set to On Actor Begin Overlap, this is hooked up to a set vector parameter value which changes the color of the material i set up from Green to Red. In the original post I supplied that screenshot.

So if that makes any sense what I am trying to achieve is this,

When the player walks up to the breaker box, instead of just one light turning Green to Red, I was trying to have all 4 of the lights change. My original blueprint works, but like I said I can only target one of the 4 meshes. I suppose I could make 4 entirely different Material instances but 1) that seems like it would slow the game down (im not sure if thats even true) and 2) i figured there would be a simpler way to do this.

If its too much work I will settle for having One light change (which is still fine with me as im still very new to blueprinting, so that was a challenge itself)

Hope that makes sense, and please if you are unsure of what I am trying to get at then dont let me bother you!!

Ok, so on overlap, do this

( or GoRed etc… )

Ok let me give that a try, do I need to have those things in the Light/Button BP still that you had posted a few replies back?

No, that’s what you have in the level BP on overlap? You replace your overlap code with that.

Keep how you’re doing the overlap at the moment, it’s the foreach loop you need.