Implent A global OnClicked Event For all UMG buttons


I’m building a menu heavy game. Where buttons can be created dynamically and removed also dynamically, my preferred method of doing things would be to create a few different types of buttons, I will mark these buttons with a child which will hold their type. What I want to have is a SINGLE OnClicked event for all my buttons, and once the event is fired I will find out its type and with the type from the child and I will execute a certain set of actions. Anyone know of a proper way to implement a global an OnClicked event like the one I am describing.

Thank You!

Create a new widget, add just a button, build your intended OnClicked event code in this widget.
Now in every other new widget you create, scroll to the bottom of the content list to UserCreatedContent and your button will be there, simply drag and drop it anywhere in the widget like a regular button.

Well I’m not using a regular button, I’m using ovdous buttons, which are mainly buttons that can be alpha mapped. The idea is, I need those buttons on the main widget so i can freely edit their image and adjust them to fit perfectly and if I place the button in another widget then I’ll lose that. So I’m hoping if there is a way to Bind the OnClickEvents of these buttons while still getting a reference to the clicked button so I can determine what the next action is. ie. I want to delegate the event with a single parameter.

You can use the Event Dispatcher. It’s a bit tricky to understand at first, but these Videos and posts explain it nicely:

So you can create a master Widget/Actor and have the callable Event in there, then for every widget you create get the reference to the BP_Master and on the OnClick event call the Event Dispatcher in the BP_Master.

Hope I could help, and if you have any questions just ask.
Good luck