‎ ‎
On the Asset Store
BlackBox
BlackBox
  • Intro
  • Changelog
  • Troubleshooting
  • Main features
    • Locking Prefabs
      • Temp Unlock
      • Extra locking options
    • Reveal
      • Properties
        • UnityEvents as buttons
      • Entire components
      • Object references
      • Methods
      • Reveal lists
    • Disable Apply
  • Integrations
    • Odin Inspector
  • Other
    • Selection type
    • Project Settings
Powered by GitBook
On this page
  1. Main features
  2. Reveal
  3. Properties

UnityEvents as buttons

Last updated 5 months ago

While you can reveal UnityEvent type properties just , you can also decide to reveal them as a button, very much like you can do .

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:

[RevealEventAsAttribute] public UnityEvent _certainConditionEvent;

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.

like any other
with methods
A revealed UnityEvent
The same UnityEvent now displayed as a button