How to dispatch button press to level BP
I've made a widget blueprint (options-menu) with 3 buttons. The widget is added inside the level as an actor.
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:
answered Mar 07 '17 at 01:11 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here