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

public UIView(GameObject parent, 
    VisualElement parentElement, 
    UIStartVisibility startVisibility = UIStartVisibility.Visible, 
    float fadeDuration = 0.5f, 
    EasingMode easingMode = EasingMode.EaseOutCirc)
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.

fadeDuration

float

Specifies the duration of the fade transition, in seconds.

easingMode

EasingMode

Defines the easing effect applied during fade transitions.

Public Properties

Name
Type
Description

Parent

VisualElement

Provides access to the VisualElement parent for this view.

Fade

Manage fade transitions of the UIView.

UIElementManager

UIElementManager 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.

Public Methods

AddAction

public void AddAction(IUIViewAction action)

Adds a new action to the view's action list. If the view is currently visible (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.

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

UIView.AddAction(new UIViewActionEscape(() => Return()));

Learn more at Actions.

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

Last updated