docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class Modal

    The Modal Popup class.

    Inheritance
    object
    Popup
    Popup<Modal>
    Modal
    Inherited Members
    Popup<Modal>.shown
    Popup<Modal>.dismissed
    Popup<Modal>.SetContainerView(VisualElement)
    Popup<Modal>.SetKeyboardDismiss(bool)
    Popup<Modal>.SetLastFocusedElement(Focusable)
    Popup.keyboardDismissEnabled
    Popup.view
    Popup.containerView
    Popup.referenceView
    Popup.contentView
    Popup.rootView
    Popup.Dismiss()
    Popup.Dismiss(DismissType)
    Popup.Show()
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.AppUI.UI
    Assembly: Unity.AppUI.dll
    Syntax
    public sealed class Modal : Popup<Modal>

    Properties

    fullscreenMode

    Set the fullscreen mode for this Modal.

    See ModalFullScreenMode values for more info.

    Declaration
    public ModalFullScreenMode fullscreenMode { get; set; }
    Property Value
    Type Description
    ModalFullScreenMode

    outsideClickDismissEnabled

    True if the Modal can be dismissed by clicking outside of it, False otherwise.

    Declaration
    public bool outsideClickDismissEnabled { get; set; }
    Property Value
    Type Description
    bool

    outsideClickStrategy

    The strategy used to determine if the click is outside the Modal.

    Declaration
    public OutsideClickStrategy outsideClickStrategy { get; set; }
    Property Value
    Type Description
    OutsideClickStrategy

    Methods

    AnimateViewIn()

    Start the animation for this popup.

    Declaration
    protected override void AnimateViewIn()
    Overrides
    Popup.AnimateViewIn()

    Build(VisualElement, VisualElement)

    Build a new Modal component.

    Declaration
    public static Modal Build(VisualElement referenceView, VisualElement content)
    Parameters
    Type Name Description
    VisualElement referenceView

    An arbitrary UI element inside the UI panel.

    VisualElement content

    The VisualElement UI element to display inside this Modal.

    Returns
    Type Description
    Modal

    The Modal instance.

    Exceptions
    Type Condition
    ArgumentNullException

    If referenceView is null.

    GetFocusableElement()

    Returns the element that will be focused when the view will become visible.

    The default value is `null`.

    Declaration
    protected override VisualElement GetFocusableElement()
    Returns
    Type Description
    VisualElement

    The element that will be focused when the view will become visible.

    Overrides
    Popup.GetFocusableElement()

    HideView(DismissType)

    Called when it is time to hide the popup.

    Declaration
    protected override void HideView(DismissType reason)
    Parameters
    Type Name Description
    DismissType reason

    The reason why the popup should be dismissed.

    Overrides
    Popup.HideView(DismissType)

    InvokeShownEventHandlers()

    Called when the popup has become visible. This method will invoke any handlers attached to the shown event.

    Declaration
    protected override void InvokeShownEventHandlers()
    Overrides
    Popup<Modal>.InvokeShownEventHandlers()

    SetFullScreenMode(ModalFullScreenMode)

    Set a new value for fullscreenMode property.

    Declaration
    public Modal SetFullScreenMode(ModalFullScreenMode mode)
    Parameters
    Type Name Description
    ModalFullScreenMode mode

    The new value.

    Returns
    Type Description
    Modal

    The Modal object.

    SetOutsideClickDismiss(bool)

    Activate the possibility to dismiss the Modal by clicking outside of it.

    Declaration
    public Modal SetOutsideClickDismiss(bool dismissEnabled)
    Parameters
    Type Name Description
    bool dismissEnabled

    True to activate the feature, False otherwise.

    Returns
    Type Description
    Modal

    The modal

    SetOutsideClickStrategy(OutsideClickStrategy)

    Set the strategy used to determine if the click is outside the Modal.

    Declaration
    public Modal SetOutsideClickStrategy(OutsideClickStrategy strategy)
    Parameters
    Type Name Description
    OutsideClickStrategy strategy

    The strategy to use.

    Returns
    Type Description
    Modal

    The modal

    ShouldAnimate()

    Implement this method to know if the popup should call AnimateViewIn() and AnimateViewOut(DismissType) methods or not.

    Declaration
    protected override bool ShouldAnimate()
    Returns
    Type Description
    bool

    True if you want to animate the popup, False otherwise.

    Overrides
    Popup.ShouldAnimate()

    ShouldDismiss(DismissType)

    Check if the popup should be dismissed or not, depending on the reason.

    Declaration
    protected override bool ShouldDismiss(DismissType reason)
    Parameters
    Type Name Description
    DismissType reason

    Why the element has been dismissed.

    Returns
    Type Description
    bool

    True if the popup should be dismissed, False otherwise.

    Overrides
    Popup.ShouldDismiss(DismissType)
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)