UI Actions

UI Actions are a core feature of the UIView system that allow developers to link custom behaviors to the view's visibility transitions (fade in/out). These actions implement the IUIViewAction interface and are executed automatically whenever the UIView's visibility changes.

Lifecycle

  • OnFadeIn: Called when the UIView becomes visible (fades in).
  • OnFadeOut: Called when the UIView becomes hidden (fades out).

This provides a simple, event-driven way to manage UI behavior that needs to sync with the view's state.

Default Actions

UIViewActionEscape

This class allows you to push and pop a custom action(System.Action) into the InputEscapeManager in sync with the visibility of an UIView.

Constructor

Example

CSHARP

See Example: Multi Page UI for more detailed example.

UIViewActionEnableElements

Disables `VisualElements` during `OnFadeIn` and re-enables them during `OnFadeOut`.

This is particularly useful for UI navigation with keys when opening a modal or screen on top of another view.

Add this action to a modal and pass in the parent `VisualElement` of the underlying view. This will disable the elements of the underlying view when the modal becomes visible and re-enable them when the modal fades out.

Constructor

Example

CSHARP

See Example: Multi Page UI for more detailed example.