Hey guys!
Is it possible to and if so what is the best way to create a list of buttons that can fire generic events/actions/functions?
What I would like to be able to do is to have a menu with various options that can fire functions in another class or classes.
Thus far I’ve followed this tutorial by :
However his example requires the function of each button to be the same, and to be contained in the button itself.
What I’ve figured out so far: I set the button function up to fire an Event Dispatcher that my PlayerController class (where the menu is created) can listen to with a unique ID passed to the Dispatcher for each button. The issue is that the buttons are created using the Create Button function, and I obviously can’t put an event in that function and there’s no way for me to pass one in or out. I’m currently storing a reference to each of the buttons in an array when they’re created and binding the events in the Event Graph, which works but that seems a little messy. Is there a better way to do this that you’d recommend or does that sound right?
Thanks for the help!