How to dispatch button press to level BP

Hi,

I’ve made a widget blueprint (options-menu) with 3 buttons. The widget is added inside the level as an actor.

128756-screen-online-menu.png

One of the buttons (menu-btn-3 Verrassing) from my widget calls a dispatcher setMaterialDispatch (which should change the material of the floor in the level).

In the level blueprint, I create an EventBeginPlay which I then want to bind to my dispatcher (setMaterialDispatch) and then connect the dispatchter binding to an event. However, my event is not triggered. I’ve spend hours looking at tutorials and articles but it doesn’t trigger the event in my level blueprint.
It does work when, in my level blueprint, I add it to the viewport and set the mouse cursor, then connect it to the BindEvent to setMaterialDispatch. But since I bind it to the Viewport, I get a menu on top of my level which I don’t need (since my menu is inside the level, mapped to an actor). I want to click/press the button (Verrassing) directly inside the level. If I however remove the nodes of the AddtoViewport and the set (Mouse cursor) and directly bind it to the dispatcher, it doesn’t work anymore.

Ideally, this is what I think should work but it doesn’t work:

Can somebody help me please? Thanks in advance for your support!

The widget you are creating in the Level Blueprint with CreateWidget there, is not the same one that already exist in your scene, as in, they are two separate actors. It needs a reference to the correct actor to bind the event.

Instead, create a reference to the 3D widget in your level blueprint, by clicking it in the scene, opening your level blueprint, right clicking in the graph and picking “Create a Reference to [your actor]”.

Then do the below:

Hi Mosel3y,

thank you soooooo much for your solution. It works!
I followed your clear instructions and suddenly the material of my floor changed. Really great! :slight_smile:

It’s the first time I had to ask the community for help and it got answered so fast. WOW.

Good luck with your Unreal projects and again, many thanks.