Download

Switch material with menu

Can anyone provide a working example of how to switch materials in game through a menu widget? I’ve managed to call up a menu widget when in range of an blueprintobject, and I’ve also managed to set up a custom event that switch material if I press the “x” key. However I want the material to switch when I use the menu instead of pressing the “x” key. How do I get the menu widget to talk to the blueprintobject?

In your widget bp you just have to **cast **to your other blueprint which changes the material - now “set” the variable (dont know how you change the material) to a value inside your widget blueprint. :slight_smile:

So what I want to do is to change material on a table top and this is my blueprint for doing that. I have a custom event hooked up to a set material node. If I switch the custom event for an input key( “x” in my case) this works like a charm in game.

I tried to trigger the custom even with “cast to” in my widget blueprint but I cant get it to work. Am I missing something?

&stc=1

Also, as soon as put the “cast to” node in my widget blueprint and compile, my table top blueprint gets “uncompiled”, and then when I compile the table top blueprint the widget blueprint gets uncompiled. Is this ok?