- create a new widget with just a button (no canvas), an
Instance Editable
variable and anEvent Dispatcher
:
Overrride onAddedToFocusPath
→ call dispatcher, pipe in text
- in your main widget, instead of native buttons, add your fancy custom buttons:
- select all of them and flag them as
isFocusable
:
- select each of them, and edit their text variable:
This is how you can associate data with a button - like selecting another character. Since each button is a standalone widget, you can add any variables and have the widget send them to whoever is listening. Here, it’s just text but it can be a class to spawn.
- in the same widget, bind their dispatchers:
- when adding the main widget, choose which button is focused by default (if any):
- the result: