logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityUiDropdownComponent

    Unity UI dropdown component that provides expandable list selection functionality with keyboard and mouse navigation.
    Extends selector component to handle dropdown-specific behaviors including list expansion, option navigation, and selection confirmation.
    Implements IUiCancellable and IUiSubmittable interfaces for comprehensive dropdown interaction management within the Unity UI system.

    Inheritance
    object
    UnityUiComponent
    UnityUiInteractableComponent
    UnityUiSubmitComponent
    UnityUiSelectorComponent
    UnityUiDropdownComponent
    Implements
    IUiInteractable
    IUiComponent
    IUiSelectable
    IUiCancellable
    IComponent
    IFoundationSettings
    IUiSubmittable
    Inherited Members
    UnityUiSelectorComponent.OnEnable()
    UnityUiSelectorComponent.SetValue(string)
    UnityUiSelectorComponent.SetIntValue(int)
    UnityUiSelectorComponent.SetFloatValue(float)
    UnityUiSelectorComponent.GetSelectedValue()
    UnityUiSelectorComponent.SetSelectableValues(ConfigurationEntry[])
    UnityUiSelectorComponent.SelectableActions
    UnityUiSelectorComponent.SelectableParameters
    UnityUiSubmitComponent.InitializeVisualElement()
    UnityUiSubmitComponent.SubmittableActions
    UnityUiInteractableComponent._contentWrapperGameObject
    UnityUiInteractableComponent._labelGameObject
    UnityUiInteractableComponent._highlightGameObject
    UnityUiInteractableComponent._valueGameObject
    UnityUiInteractableComponent._mainButtonGameObject
    UnityUiInteractableComponent._optionValueUiComponentType
    UnityUiInteractableComponent._decorationsCoroutine
    UnityUiInteractableComponent._buttons
    UnityUiInteractableComponent._isDragging
    UnityUiInteractableComponent._wantsHighlightVisible
    UnityUiInteractableComponent._widthLocked
    UnityUiInteractableComponent.SetupDecorations(bool)
    UnityUiInteractableComponent.AdaptHighlightWidthToText(Image, TMP_Text, RectTransform, float, bool, bool, GameObject)
    UnityUiInteractableComponent.GetHighlightTargetWidth(Image, TMP_Text, RectTransform, float, bool, bool, GameObject)
    UnityUiInteractableComponent.RelocateHighlightImage(Image, TMP_Text, RectTransform, RectTransform)
    UnityUiInteractableComponent.GetHighlightImage(Image, TMP_Text, RectTransform)
    UnityUiInteractableComponent.SetWidthLocked(bool)
    UnityUiInteractableComponent.IsWidthLocked()
    UnityUiInteractableComponent.SetAutoDecorationsEnabled(bool)
    UnityUiInteractableComponent.GetDecorationsPassVersion()
    UnityUiInteractableComponent.RunDecorations(bool)
    UnityUiInteractableComponent.CalculateLogicalWidth()
    UnityUiInteractableComponent.Awake()
    UnityUiInteractableComponent.OnDisable()
    UnityUiInteractableComponent.RefreshLayoutAfterTextChange()
    UnityUiInteractableComponent.SetIndex(int)
    UnityUiInteractableComponent.GetIndex()
    UnityUiInteractableComponent.SetIsDragging(bool)
    UnityUiInteractableComponent.GetIsDragging()
    UnityUiInteractableComponent.OnDraggingStart()
    UnityUiInteractableComponent.OnDraggingEnd()
    UnityUiInteractableComponent.Focus()
    UnityUiInteractableComponent.Blur()
    UnityUiInteractableComponent.SelectComponentById(string)
    UnityUiInteractableComponent.SetFocus(bool)
    UnityUiInteractableComponent.Initialize(IUiComponentParameters, IUiComponentActions, ILogService)
    UnityUiInteractableComponent.SetFocusAnimation()
    UnityUiInteractableComponent.SetDeselectedAnimation()
    UnityUiInteractableComponent.MapTMPAlignment(UiComponentAlignmentType)
    UnityUiInteractableComponent.InitializeLabel(string)
    UnityUiInteractableComponent.InitializeVisualElement(UiComponentInteractionType, UiComponentAlignmentType, float, string)
    UnityUiInteractableComponent.InitializeHighlight()
    UnityUiInteractableComponent.AlignElements(UiComponentInteractionType, UiComponentAlignmentType)
    UnityUiInteractableComponent.SetHighlightAlignment(UiComponentAlignmentType)
    UnityUiInteractableComponent.SetLabelAlignment(UiComponentAlignmentType)
    UnityUiInteractableComponent.HandleCenterAlignment(TMP_Text)
    UnityUiInteractableComponent.FlipHorizontally(GameObject)
    UnityUiInteractableComponent.SetValueAlignment(UiComponentInteractionType, UiComponentAlignmentType)
    UnityUiInteractableComponent.InitializeMirroring(UiComponentAlignmentType)
    UnityUiInteractableComponent.SetButtonAlignment(UiComponentAlignmentType)
    UnityUiInteractableComponent.SetElementPosition(float, UiComponentAlignmentType)
    UnityUiInteractableComponent.GetContentWrapperGameObject()
    UnityUiInteractableComponent.SetContentWrapperGameObject(GameObject)
    UnityUiInteractableComponent.GetLabelElement()
    UnityUiInteractableComponent.GetLabelGameObject()
    UnityUiInteractableComponent.SetLabelGameObject(GameObject)
    UnityUiInteractableComponent.SetLabelElement(IFoundationViewElement)
    UnityUiInteractableComponent.GetMainButtonElement()
    UnityUiInteractableComponent.SetMainButtonGameObject(GameObject)
    UnityUiInteractableComponent.GetMainButtonGameObject()
    UnityUiInteractableComponent.SetMainButtonElement(IFoundationViewElement)
    UnityUiInteractableComponent.SetHighlightGameObject(GameObject)
    UnityUiInteractableComponent.GetHighlightElement()
    UnityUiInteractableComponent.GetHighlightGameObject()
    UnityUiInteractableComponent.SetHighlightElement(IFoundationViewElement)
    UnityUiInteractableComponent.GetValueElement()
    UnityUiInteractableComponent.SetValueGameObject(GameObject)
    UnityUiInteractableComponent.GetValueGameObject()
    UnityUiInteractableComponent.SetValueElement(IFoundationViewElement)
    UnityUiInteractableComponent.SetLabelText(string)
    UnityUiInteractableComponent.SetValueText(string)
    UnityUiInteractableComponent.GetButtonElements(bool)
    UnityUiInteractableComponent.GetButtonGameObjects(bool)
    UnityUiInteractableComponent.SetButtonElements(List<IFoundationViewElement>)
    UnityUiInteractableComponent.GetUiComponentInteractionType()
    UnityUiInteractableComponent.SetUiComponentInteractionType(UiComponentInteractionType)
    UnityUiInteractableComponent.InitializeButtons()
    UnityUiInteractableComponent._decorationsInitialized
    UnityUiInteractableComponent.InteractableParameters
    UnityUiInteractableComponent.InteractableActions
    UnityUiInteractableComponent.DecorationsReady
    UnityUiComponent._animators
    UnityUiComponent.UpdateUiElement<T>(Action<T>, IFoundationViewElement)
    Namespace: Serenity.Ui.Infrastructure.Components
    Assembly: Serenity.UnityUi.Infrastructure.dll
    Syntax
    public class UnityUiDropdownComponent : UnityUiSelectorComponent, IUiInteractable, IUiComponent, IUiSelectable, IUiCancellable, IComponent, IFoundationSettings, IUiSubmittable

    Constructors

    UnityUiDropdownComponent()

    Initializes a new Unity UI dropdown component with dropdown interaction type configuration.
    Sets up the component for expandable list selection operations within the UI system.

    Declaration
    public UnityUiDropdownComponent()

    Fields

    _isHidingDropdown

    Declaration
    protected bool _isHidingDropdown
    Field Value
    Type Description
    bool

    Indicates whether the dropdown is currently being closed.

    _isOpeningDropdown

    Declaration
    protected bool _isOpeningDropdown
    Field Value
    Type Description
    bool

    Indicates whether the dropdown is currently being opened.

    Properties

    CancellableActions

    Gets or sets the cancellable actions interface for dropdown cancellation event handling.
    Manages callbacks for dropdown dismissal and cancellation operations.

    Declaration
    public IUiCancellableActions CancellableActions { get; set; }
    Property Value
    Type Description
    IUiCancellableActions

    The cancellable actions interface

    Methods

    Cancel()

    Handles cancellation actions with dropdown state-aware behavior.
    If dropdown is open, closes the dropdown without selection; otherwise invokes cancel actions for the component.
    Provides context-sensitive cancellation functionality for dropdown interactions.

    Declaration
    public override void Cancel()
    Overrides
    UnityUiInteractableComponent.Cancel()

    DecrementValue()

    Overrides decrement value to disable default selector behavior.
    Dropdown components handle value changes through selection rather than direct decrement operations.
    Empty implementation prevents unintended value modifications outside of dropdown selection flow.

    Declaration
    public override void DecrementValue()
    Overrides
    UnityUiSelectorComponent.DecrementValue()

    GetDropdownSelectables(CustomTMPDropdown)

    Gets all selectable UI elements within the dropdown list excluding the dropdown itself.
    Returns the list of toggles and other selectable elements that represent dropdown options.
    Filters out the main dropdown component to focus on option selectables only.

    Declaration
    public List<Selectable> GetDropdownSelectables(CustomTMPDropdown dropdown)
    Parameters
    Type Name Description
    CustomTMPDropdown dropdown

    The dropdown component to scan for selectables

    Returns
    Type Description
    List<Selectable>

    List of selectable elements representing dropdown options, or null if dropdown is invalid

    IncrementValue()

    Overrides increment value to disable default selector behavior.
    Dropdown components handle value changes through selection rather than direct increment operations.
    Empty implementation prevents unintended value modifications outside of dropdown selection flow.

    Declaration
    public override void IncrementValue()
    Overrides
    UnityUiSelectorComponent.IncrementValue()

    IsShowingDropdown()

    Checks whether the dropdown list is currently expanded and visible to the user.
    Returns true if the dropdown is showing its option list, false if it's collapsed.

    Declaration
    public bool IsShowingDropdown()
    Returns
    Type Description
    bool

    True if dropdown is expanded, false if collapsed

    SelectDropdownOption()

    Selects the dropdown option that matches the current caption text.
    Finds and selects the option whose text matches the dropdown's displayed caption value.
    Useful for synchronizing selection state with displayed content.

    Declaration
    public void SelectDropdownOption()
    Exceptions
    Type Condition
    NullReferenceException

    Thrown when dropdown component is not found

    ArgumentOutOfRangeException

    Thrown when matching option index is invalid

    SelectDropdownOption(int)

    Programmatically selects a dropdown option by its index with validation.
    Updates the dropdown's selection state and visual appearance to reflect the specified option.
    Provides external interface for dropdown option selection with bounds checking.

    Declaration
    public void SelectDropdownOption(int index)
    Parameters
    Type Name Description
    int index

    The zero-based index of the option to select

    Exceptions
    Type Condition
    NullReferenceException

    Thrown when dropdown component is not found

    ArgumentOutOfRangeException

    Thrown when index is outside valid range

    SelectNextComponent()

    Overrides next component selection to handle dropdown navigation.
    If dropdown is open, navigates to next option within the dropdown; otherwise performs normal component navigation.
    Provides context-aware navigation behavior for dropdown interactions.

    Declaration
    public override void SelectNextComponent()
    Overrides
    UnityUiInteractableComponent.SelectNextComponent()

    SelectPreviousComponent()

    Overrides previous component selection to handle dropdown navigation.
    If dropdown is open, navigates to previous option within the dropdown; otherwise performs normal component navigation.
    Provides context-aware navigation behavior for dropdown interactions.

    Declaration
    public override void SelectPreviousComponent()
    Overrides
    UnityUiInteractableComponent.SelectPreviousComponent()

    SetValue(int)

    Sets the selected option by index and updates the dropdown display with validation.
    Overrides base selector behavior to properly update the Unity dropdown component's visual state and option selection.
    Validates the index is within the valid range of dropdown options before applying the change.

    Declaration
    public override void SetValue(int index)
    Parameters
    Type Name Description
    int index

    The zero-based index of the option to select

    Overrides
    UnityUiSelectorComponent.SetValue(int)
    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown when index is outside the valid range of dropdown options

    Submit()

    Handles submission actions with dropdown state-aware behavior.
    If dropdown is closed, opens the dropdown list; if open, selects the currently highlighted option and closes the dropdown.
    Provides dual-mode submission behavior for intuitive dropdown interaction.

    Declaration
    public override void Submit()
    Overrides
    UnityUiSubmitComponent.Submit()
    Exceptions
    Type Condition
    NullReferenceException

    Thrown when dropdown component is not found

    UpdateOption()

    Updates the dropdown option selection to match the current selected value.
    Synchronizes the Unity dropdown component's selected index with the internal selection state.

    Declaration
    public void UpdateOption()

    Implements

    IUiInteractable
    IUiComponent
    IUiSelectable
    IUiCancellable
    IComponent
    IFoundationSettings
    IUiSubmittable
    In this article
    © 2026 Serenity. All Rights Reserved