Change Material Color from Menu

hi,

I ve menu when i clicked my wall mesh

I made a color menu (with widget blueprint) and it has 3 buttons (red, black, blue)

My question is how can i change that wall material from that menu clicks

Make sure the wall has a material applied to it that makes use of a vector parameter for its colour channel. On begin play for the wall, make a material instance dynamic from this material and apply it to the wall.

Create a custom event that takes a linear color and sets the vector parameter of the dynamic material instance to this color.

In your widget’s begin play, find actors of class, the class being the wall’s class. If you have multiple walls, run a for each loop on the return array. check each loop for the name of your specific wall. If there’s only one, get array index 0 and store it in a variable.

On a click of your button, invoke the custom event on your wall reference passing in the color you want.

well i made what you said but i think something wrong

this one my wall bp

and this one my const.

and this one my event graph with custom event

and finally my widget button click event

I would cast the mesh in you widget.

Set a variable & Nodes in the BP to change color

When you click the button, bind it so it pulls the variable and gives it a different texture.

Should work.

well m not understanding :slight_smile:

To change material

or

http://www.luchadordev.com/tutorials/UE4/UE4Tut_RandomColorMat.html

or

i already watched these videos,

i can change wall color when i clicked the wall or when i put trigger box,

my problem is i cant change it from widget menu, i cant call my wall blueprint from there

If the wall is a BP, should be able to call, I am able to call other BP in my widgets.

change your nick you are the lifesaver

thanks much, its done … =)

Happy to help.

Good luck

Hi ,
i cant make toggle visibility of static mesh from widget menu button, i cant drag an drop static mesh from scene to graph as target.
Where is my mistake?
Thanks

make your mesh with blueprint and write function which is set visiblity on / off
and call that function from widget menu

Hi Ugurson, Thank you very much for the advice, me it does not work, but it’s because I’m a UE4 beginner. I’m looking for some accurate video - Widget button-onclick-static mesh in scene toggling visibility. I do not understand why some functions are not directly from widget graphs. Thank you for your