Can someone demonstrate how to bind a custom control to an Action property?
The document at Unity - Manual: Define a data source for runtime binding states the following:
it’s possible to bind to delegates such as Action or Func delegate types. To bind to delegate fields or properties, use the = operator instead of += or -= . If you need to add or remove delegates instead of assigning them, you might need to implement a custom binding type.
It works exactly the same as any other binding.
Thank you @spiney199 . I have this working, setting up the binding within the UXML document.
Is there a way to set up Action bindings from within the UI Builder? I can’t find a way to expose Action properties within UI Builder’s inspector window.
The [UxmlAttribute] attribute is used to expose properties in the inspector, though if something doesn’t draw that would indicate that serialisation for that isn’t currently supported, or there is no property drawer for it.
Binding delegates I believe is code and UXML only without doing some custom work.