# How to toggle color parameter in blueprint for dynamic material

**URL:** <https://forums.unrealengine.com/t/how-to-toggle-color-parameter-in-blueprint-for-dynamic-material/408391>\
**Category:** Rendering\
**Tags:** toggle, unreal-engine, color, question, Blueprint\
**Created:** [October 31, 2017, 10:52am UTC](https://forums.unrealengine.com/t/how-to-toggle-color-parameter-in-blueprint-for-dynamic-material/408391 "2017-10-31T10:52:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_1c00765c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1c00765c](https://forums.unrealengine.com/u/anonymous_user_1c00765c)\
**Post date:** [October 31, 2017, 10:52am UTC](https://forums.unrealengine.com/t/how-to-toggle-color-parameter-in-blueprint-for-dynamic-material/408391/1 "2017-10-31T10:52:55Z")

</div>

Hello there,

I have managed to make dynamic material that can change color in Game play, but for each change I have to press different key on the keyboard. Here is my blueprint setting for this to work:

 ![218526-event-graph.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/6/4/0641ff7f273a716bceb519b7a152b21bbde5de65.jpeg)

 ![218527-construction-script.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/4/a/94adf9a22073731e527b393a7915f92055b19f9d.jpeg)

How, what I want to do is to change parameter values of the color whit pressing only one key on the keybord. How can I do that? Can anybody help?

Thank you!

---

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [October 31, 2017, 11:06am UTC](https://forums.unrealengine.com/t/how-to-toggle-color-parameter-in-blueprint-for-dynamic-material/408391/2 "2017-10-31T11:06:22Z")

</div>

In simple way you can use FlipFlop. It will execute A or B outputs alternately.

But to have more control on this you can use some boolean variable like “ColorChanged”, and use it as condition to change color. For example, by default ColorChanged == false. When you press key, with Branch check ColorChanged.

On false → set color to whatever you want → set ColorChanged to true.

On True → set color to default one → set ColorChanged to false.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1c00765c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1c00765c](https://forums.unrealengine.com/u/anonymous_user_1c00765c)\
**Post date:** [October 31, 2017, 12:27pm UTC](https://forums.unrealengine.com/t/how-to-toggle-color-parameter-in-blueprint-for-dynamic-material/408391/3 "2017-10-31T12:27:58Z")

</div>

This will work if I want to change two values, in my case I have three. I made it work with this event graph:

 ![218529-working.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/1/0/c1098c159faffa2e20e16cd15916b3a22c855968.jpeg)

But now I have a new problem, I want to change two different materials on one mesh and made this construction but doesn’t change anything in Game play…

 ![218530-change-material.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/6/a/d6a2a82e6fb4069b9b3455a0e0d9705a47434d8f.jpeg)

Where is my mistake?
