I’ve got a umg widget with a few buttons.
In the game level I want to know which of the buttons was clicked.
Instead of hooking up each button to a separate event dispatcher I was wondering if one event dispatcher can be used and if the variable name of the button can be retrieved to determine which button was clicked.
Yes, in the widget create an Event Dispatcher and have it dispatch the button reference. Each button click calls the same dispatcher in the widget. Whoever receives the call, will get the clicked button.
You can, of course, have more data in the dispatcher. Since sending a button makes little sense in most cases, you may want to send something else - like an enumerator that defines what the clicked button was supposed to do: