Change dynamic material via HUD


I’m trying to change the emissive intensity parameter of a dynamic material instance using a simple slider in the HUD.

I’m unsure why it won’t respond.

There is a parameter set in the master material.

When the blueprint is spawned it creates a dynamic material instance and assigns it to the mesh component.

When I attempt to change the slider in my HUD widget…I dont get a result.

Is there anything jumping out as being wrong with this ?

Thanks a lot.

How does the widget know which Selected Light it’s dealing with?

Make video else we cannot know what are you dealing with … Maybe use set material on value change and assign the parameter?

You should follow some tutorial/documentation about blueprint communication.
Getting infromation out or in to umg blueprints is not easy.

Easiest way for your case would be:

  • create event in game mode (or other easily accessible blueprint) lets name it “Event_Change_Material”
  • create event dispatcher in same blueprint “Dispatcher_Change_material”
  • from umg blueprint call that event in game mode “Event_Change_Material” when umg is updating slider
  • now you need actor with that dynamic material (and mesh), because to change dynamic material during runtime you need to create dynamic material instance, else it will not change in runtime. So easiest is to have actor and in its construction script create instance, then apply to mesh.
  • in that actor assign to dispatcher “Dispatcher_Change_material” then change material when it is called.

Problem has 2 separate tasks:

  • signaling actor with material that it needs to change
  • changing material

So split it in two, first work on communication (ie. print some output when actor gets signal to change material). Then work on changing material. So many problems with blueprints arise when you have multiple errors (bugs) and nothing seems to work, so fix that stuff step by step.