I am a very beginner to all this and I just can’t seem to figure it out.
I created a simple button in a widget and I would like the button when clicked to activate an event that is in this blueprint.
Now I created an on-clicked event for this button, but I am not sure how to tell it to activate the even in the other blueprint. To be honest I am not sure if this is even possible.
But if you know how to do this I would love to know how, or you could point me in the right direction of a tutorial?
Thank you very much for your time ^^
It is possible. When you create the widget, you can subscribe to its events. Create an event in the widget event dispatcher, call it in the widget when you press your button. In the BP, bind to this event when you create the widget.
Thank you so much for your answer, unfortunately I am a complete beginner at all this.
I understand the creating the widget event dispatcher and calling on it when you press the button, however I am stuck on the binding part. I am not quite sure how to do this.
When you create the widget (as shown in your screenshot), drag a wire from the Return Value (or from the saved variable) and type the name of your event. Select Assign + %EventName%
Hi, sorry to bother you again.
I didn’t fully understand what you meant, but I think I got close. At least the code seems to work when I compile it. However when I press the button nothing seems to happen.
Once again, thank you for your help ^^
That’s because you never connected it:
Also, there’s no need to cast here.
Do note that buttons already have a bunch of dispatchers, if all you need is a click:
You would need a custom Event Dispatcher if you wanted to send some additional data - like a message in your example!
I suggest downloading this free project, which has a lot of different stuff inside, how to communicate between blueprints, buttons, ecc. Is a very good project because there are working examples that you can study and even copy paste out of them.
Oh my god, thank you guys all so much it worked !