Key events to trigger Material changes?

Hello!

Just beginning to learn here. Wondering what would be the simplest way to trigger a change in a certain material with a Key event? Namely, I have a Material with some emissive elements in it that I only want to begin to ‘glow’ when a button is pressed.

Use a scalar parameter in the material to drive the glow intensity.
Then, in a BP, create a dynamic material for the mesh that has that material and control the parameter.
I’ll prepare some pics.

Here they are:

1 - in the material create a scalar parameter to drive the glow intensity:

2 - in the construction script of your BP, create a dynamic material instance:

3 - now in the event graph, control the parameter (in this case every time you press G, it increases the glow by 5):

4 - and the result is:

Thank you so much, once more! :smiley: One thing, how can I have it be a toggle (emission on/off) instead?

It can be better, but I tried to keep the number of nodes to the minimum:

value = 0 => glow off

value = 50 => glow on (you can change this value for more or less glow)

Thanks will try that out. Having trouble connecting these nodes (see pic)

In “Create Dynamic …” it’s not “Capsule component”. It’s “Mesh Component”.

In “Set Scalar …” don’t use “Mesh”. Just connect the outputs of “Set” to it.

Great! That fixed it! One more question: In the set scalar parameter value node. How do I get glow intensity? I tried to create a variable but I don’t how to link it to glow intensity?

Also, is this in the third person character blueprint or the actor (homegirl) blueprint? :smiley:

Drag a wire from “Value” and “promote to variable” and rename it.

All this is in whatever BP that contains the mesh with the material you want to control. In my case, it was the mesh of the ThirdPersonCharacter. In your case, …