UIView

The UIView is the base class responsible for managing the lifecycle and visibility of an UI Element. It provides control over UI visibility states, fade animations, and allows for custom actions during these transitions.

Constructor

Name Type Description
parent GameObject Parent GameObject used to control lifecycle of the UIView.
parentElement VisualElement The VisualElement that serves as the parent for this UIView.
startVisibility UIStartVisibility The UIStartVisibility enum defines the possible initial visibility states of the parentElement.
focusElement VisualElement The VisualElement element to focus whenever UIView becomes visible.
fadeDuration float Specifies the duration of the fade transition, in seconds.
easingMode EasingMode Defines the easing effect applied during fade transitions.
debug bool Logs fade transitions, enable/disable events, and UI Actions.

Public Properties

Name Type Description
Parent GameObject Parent GameObject used to control lifecycle of the UIView.
ParentElement VisualElement The VisualElement that serves as the parent for this UIView.
LunaUIManager LunaUIManager LunaUIManager tracks interactable visual elements, enabling mass activation or deactivation within a UIView. You can also set a blocking element to prevent interaction with other elements until it is clicked.
Fade FadeUIElement Manage fade transitions of the UIView.
IsEnabled bool todo
easingMode EasingMode Defines the easing effect applied during fade transitions.

Public Methods

AddAction

Adds a new action to the view's action list.

If the view is currently faded in, the action's OnFadeIn method will be triggered immediately.

The action will be automatically enabled or disabled in sync with the view's fade-in or fade-out state.

Adds a new action to the view's action list.

Name Type Description
action IUIViewAction Action to add to the UIView.
activate bool Activates the Action immediately if the UIView is currently enabled. If the UIView is not enabled, the Action is not triggered even if this is true.

Example

Register an action that returns to the previous screen when the Escape key is pressed.

CSHARP

Learn more at UI Actions.

See Example: Multi Page UI which demonstrates usage of UIViewActionEscape.

AddChild

When you have nested UIViews with UI Actions, you might need to register their parent-child relationships.

Whenever a parent UIView is enabled or disabled, it will trigger the UI Actions of its children.

The Example: Multi Page UI also demonstrates parent-child relationships.