Skip to main content

ButtonEvents

A class in Root.Township, Alta.Meta.UI.

Exposes a game Button's press, release and enabled changes as Unity events for wiring in the inspector.

Constructors​

MemberWhat it is
ButtonEvents()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

5 private and internal fields
MemberWhat it is
private Button buttonThe button, filled from the same object by default.
private UnityEvent onDisableFired when the button becomes disabled.
private UnityEvent onEnableFired when the button becomes enabled.
private UnityEvent onPressFired when the button is pressed.
private UnityEvent onReleaseFired when the button is released.

Methods​

2 private and internal methods
MemberWhat it is
private void Awake()Hooks the button's pressed, released and enabled-changed events to the Unity events.
private void HandleEnabledChanged(Button button)Fires onEnable or onDisable to match the button's new state.