- Home /
Custom control event setup
Hello all,
I'm trying to create a custom menu using the new Unity UI. The menu is supposed to create the buttons dynamically when it spawns.
What I'm wondering is, what is the best way to wire up the event system in such a case?
I would like this menu to turn into a prefab and that means I want other objects to subscribe to an event on the menu, because the buttons don't exist yet.
The centralization of messages is ok because each button has a link to the menu and, when clicked, it calls a method on the menu. But then I don't know how to trigger an event from that method to be able to notify subscriber controls. Ideally, I would like to set up some custom event, but if that's not possible, then I could abuse one of the existing ones, for example Submit.
Does anyone have an idea of how to set this up?
Thanks a lot for your help