I will have an “inventory” widget with a lot of buttons, 50 buttons+,
instead of manuallly place 50 event “On Clicked (BTN_01)…”
can i have 1 event general evnet (on click button), and then ask , if is BTN_01 , do this, if BTN_02 do this…?
I am little lost,
maybe i can use Event dispatchers? how?
maybe i can place custom widget inside the inventory and , let the child-widget talk to the parent? how?
other options?
You can do much better than this. Wrap each button in a widget - this gives you a fully configurable widget. Create a dispatcher that broadcasts data from the button. So you can do this, for example:
And you can do this from outside of the parent widget; you can actually use a dispatcher to evoke events in another actor, here in the LB but it can be anything, of course:
Above, any click from a button will trigger an event in this particular actor, pushing in enumeration data defined in the second screenshot. Binding / unbinding can be done dynamically so you can hook events like this on the fly and without worrying about those actors getting destroyed.