UnityEvents as buttons
While you can reveal UnityEvent
type properties just like any other, you can also decide to reveal them as a button, very much like you can do with methods.
However, revealing a UnityEvent
as a button allows you to specify one argument for each method invoked, and to invoke multiple methods at once (which is exactly what UnityEvent
supports), making it a much more powerful tool.
Revealing a UnityEvent as a button
If a UnityEvent
property is revealed, by default it will just show with its regular UI:
To display it as a button, the property needs to be decorated with a [RevealEventAsButton]
attribute, like this:
Once the code compiles, the UnityEvent
will now show up as a button:
If the UnityEvent
has no callbacks setup, the button will show up as disabled.
Last updated