docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class Popup<T>

    A generic base class for popups.

    Inheritance
    object
    Popup
    Popup<T>
    AnchorPopup<T>
    Modal
    PopupNotification<T>
    Tray
    Inherited Members
    Popup.m_InvokeShownAction
    Popup.keyboardDismissEnabled
    Popup.view
    Popup.containerView
    Popup.referenceView
    Popup.contentView
    Popup.rootView
    Popup.Dismiss()
    Popup.Dismiss(DismissType)
    Popup.ShouldDismiss(DismissType)
    Popup.Show()
    Popup.ShowView()
    Popup.GetFocusableElement()
    Popup.ShouldAnimate()
    Popup.OnViewKeyDown(KeyDownEvent)
    Popup.OnLayoutReadyToAnimateIn()
    Popup.PrepareAnimateViewIn()
    Popup.AnimateViewIn()
    Popup.HideView(DismissType)
    Popup.AnimateViewOut(DismissType)
    Popup.FindSuitableParent(VisualElement)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.AppUI.UI
    Assembly: Unity.AppUI.dll
    Syntax
    public abstract class Popup<T> : Popup where T : Popup<T>
    Type Parameters
    Name Description
    T

    A sealed popup class type.

    Constructors

    Popup(VisualElement, VisualElement, VisualElement)

    Default constructor.

    Declaration
    protected Popup(VisualElement referenceView, VisualElement view, VisualElement contentView = null)
    Parameters
    Type Name Description
    VisualElement referenceView

    The reference view used as context provider for the popup.

    VisualElement view

    The popup visual element itself.

    VisualElement contentView

    The content that will appear inside this popup.

    Fields

    m_LastFocusedElement

    The last focused element before the popup was shown.

    Declaration
    protected Focusable m_LastFocusedElement
    Field Value
    Type Description
    Focusable

    Methods

    InvokeDismissedEventHandlers(DismissType)

    Called when the popup has been dismissed. This method will invoke any handlers attached to the dismissed event.

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

    The reason for the dismissal.

    Overrides
    Popup.InvokeDismissedEventHandlers(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.InvokeShownEventHandlers()

    SetContainerView(VisualElement)

    Set the container view where the popup will be displayed.

    Declaration
    public T SetContainerView(VisualElement element)
    Parameters
    Type Name Description
    VisualElement element

    The container view.

    Returns
    Type Description
    T

    The popup of type T.

    Remarks

    By default, the popup will be added to popup container of the first Panel ancestor of the given reference view during construction.

    SetKeyboardDismiss(bool)

    Activate the possibility to dismiss the popup via Escape key or Return button.

    Declaration
    public T SetKeyboardDismiss(bool dismissEnabled)
    Parameters
    Type Name Description
    bool dismissEnabled

    True to activate the feature, False otherwise.

    Returns
    Type Description
    T

    The popup of type T.

    SetLastFocusedElement(Focusable)

    Set the last focused element before the popup was shown.

    Declaration
    public T SetLastFocusedElement(Focusable focusable)
    Parameters
    Type Name Description
    Focusable focusable

    The last focused element.

    Returns
    Type Description
    T

    The popup of type T.

    Events

    dismissed

    Event triggered when the popup has been dismissed.

    Declaration
    public event Action<T, DismissType> dismissed
    Event Type
    Type Description
    Action<T, DismissType>

    shown

    Event triggered when the popup has become visible.

    Declaration
    public event Action<T> shown
    Event Type
    Type Description
    Action<T>
    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)