Help with Blueprint - Changing material on static mesh by clicking, then having it change back by clicking it again.

Hi,

I am working on a blueprint when you click the light switch, the material on the static mesh swaps out for an identical material but it has emissive on it using Set Material. That works fine. What I have been unable to figure out is how do I get the material to go back to the original material when I click on the light switch again.

I did a search and coudln’t find any info regarding something like this.

Any help would be greatly appreciated.

You can use a flip/flop logic to do that.
Ie for each click alternate beween action A and action B.

A reliable method would be to add a boolean varible inside your blueprint called ‘LightOn’. Then in your OnClicked Event handler (the one in the picture), you will first check if the value of LightOn is true or false (using Branch). If its false, then you will change the value of LightOn to true and then change the material to once with the emissive. On the other hand if the value of LightOn is true, then you will set it to false and change the material back to original.

Unfortunately I was never able to get the boolean method working no matter what configure I put the nodes in. The flip/flop logic worked however. Thank you. Would love to get the boolean working as it would work with so many other things I have planned for my scene. Any way you could post a blueprint?

But how come when you want to use 3 or more materials? Please Answer

See this: