-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
As an alternative to #3, what if I could put an attribute on the handler. For example, if I want to handle the ClickEvent on a button named "OK", I would do something like this:
public partial class MyWindowController: MonoBehavior {
[UIHandler("OK",)]
public void OnClicked(ClickEvent evt) {
// runs when the visual element OK raises the event ClickEvent
}
}It would generate code like this:
[RequireComponent(typeof(UIDocument))]
public partial class MyWindowController: MonoBehavior {
public void SubscribeUIHandler() {
TryGetComponent(out UIDocument document);
var root = document.root;
root.Q("OK").RegisterCallback<ClickEvent>(OkClicked);
}
}Metadata
Metadata
Assignees
Labels
No labels