docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class ObjectPicker

    A rich object/asset picker: search, tabs, a thumbnail-size slider and a custom toolbar slot above a scrollable list, over a resizable preview that adapts to its own height.

    Inheritance
    object
    CallbackEventHandler
    Focusable
    VisualElement
    BaseVisualElement
    ObjectPicker
    Implements
    IEventHandler
    IResolvedStyle
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IContextOverrideElement
    IAdditionalDataHolder
    INotifyValueChanged<string>
    Inherited Members
    BaseVisualElement.contextPrefix
    BaseVisualElement.densityOverride
    BaseVisualElement.themeOverride
    BaseVisualElement.langOverride
    BaseVisualElement.layoutDirectionOverride
    BaseVisualElement.preferredTooltipPlacementOverride
    BaseVisualElement.tooltipDelayMsOverride
    BaseVisualElement.GetLayoutDirectionUssClassName(Dir)
    VisualElement.disabledUssClassName
    VisualElement.SetActivePseudoState(bool)
    VisualElement.SetCheckedPseudoState(bool)
    VisualElement.Focus()
    VisualElement.SendEvent(EventBase)
    VisualElement.SetEnabledFromHierarchy(bool)
    VisualElement.SetEnabled(bool)
    VisualElement.MarkDirtyRepaint()
    VisualElement.IsMarkedForRepaint()
    VisualElement.ContainsPoint(Vector2)
    VisualElement.Overlaps(Rect)
    VisualElement.DoMeasure(float, VisualElement.MeasureMode, float, VisualElement.MeasureMode)
    VisualElement.ToString()
    VisualElement.GetClasses()
    VisualElement.ClearClassList()
    VisualElement.AddToClassList(string)
    VisualElement.RemoveFromClassList(string)
    VisualElement.ToggleInClassList(string)
    VisualElement.EnableInClassList(string, bool)
    VisualElement.ClassListContains(string)
    VisualElement.FindAncestorUserData()
    VisualElement.SetBinding(BindingId, Binding)
    VisualElement.GetBinding(BindingId)
    VisualElement.TryGetBinding(BindingId, out Binding)
    VisualElement.GetBindingInfos()
    VisualElement.GetBindingInfos(List<BindingInfo>)
    VisualElement.HasBinding(BindingId)
    VisualElement.ClearBinding(BindingId)
    VisualElement.ClearBindings()
    VisualElement.GetHierarchicalDataSourceContext()
    VisualElement.GetDataSourceContext(BindingId)
    VisualElement.TryGetDataSourceContext(BindingId, out DataSourceContext)
    VisualElement.TryGetLastBindingToUIResult(in BindingId, out BindingResult)
    VisualElement.TryGetLastBindingToSourceResult(in BindingId, out BindingResult)
    VisualElement.Add(VisualElement)
    VisualElement.Insert(int, VisualElement)
    VisualElement.Remove(VisualElement)
    VisualElement.RemoveAt(int)
    VisualElement.Clear()
    VisualElement.ElementAt(int)
    VisualElement.IndexOf(VisualElement)
    VisualElement.Children()
    VisualElement.Sort(Comparison<VisualElement>)
    VisualElement.BringToFront()
    VisualElement.SendToBack()
    VisualElement.PlaceBehind(VisualElement)
    VisualElement.PlaceInFront(VisualElement)
    VisualElement.RemoveFromHierarchy()
    VisualElement.GetFirstOfType<T>()
    VisualElement.GetFirstAncestorOfType<T>()
    VisualElement.Contains(VisualElement)
    VisualElement.FindCommonAncestor(VisualElement)
    VisualElement.viewDataKey
    VisualElement.userData
    VisualElement.canGrabFocus
    VisualElement.focusController
    VisualElement.disablePlayModeTint
    VisualElement.usageHints
    VisualElement.transform
    VisualElement.scaledPixelsPerPoint
    VisualElement.layout
    VisualElement.contentRect
    VisualElement.paddingRect
    VisualElement.worldBound
    VisualElement.localBound
    VisualElement.worldTransform
    VisualElement.hasActivePseudoState
    VisualElement.hasInactivePseudoState
    VisualElement.hasHoverPseudoState
    VisualElement.hasCheckedPseudoState
    VisualElement.hasEnabledPseudoState
    VisualElement.hasDisabledPseudoState
    VisualElement.hasFocusPseudoState
    VisualElement.hasRootPseudoState
    VisualElement.pickingMode
    VisualElement.name
    VisualElement.enabledInHierarchy
    VisualElement.enabledSelf
    VisualElement.languageDirection
    VisualElement.visible
    VisualElement.generateVisualContent
    VisualElement.dataSource
    VisualElement.dataSourcePath
    VisualElement.dataSourceType
    VisualElement.experimental
    VisualElement.hierarchy
    VisualElement.cacheAsBitmap
    VisualElement.parent
    VisualElement.panel
    VisualElement.visualTreeAssetSource
    VisualElement.this[int]
    VisualElement.childCount
    VisualElement.schedule
    VisualElement.style
    VisualElement.resolvedStyle
    VisualElement.customStyle
    VisualElement.styleSheets
    VisualElement.tooltip
    Focusable.Blur()
    Focusable.focusable
    Focusable.tabIndex
    Focusable.delegatesFocus
    CallbackEventHandler.RegisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.RegisterCallbackOnce<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.RegisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, TrickleDown)
    CallbackEventHandler.RegisterCallbackOnce<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, TrickleDown)
    CallbackEventHandler.RegisterCallback<TEventType>(EventCallback<TEventType>, CallbackOptions)
    CallbackEventHandler.RegisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, CallbackOptions)
    CallbackEventHandler.UnregisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType>(EventCallback<TEventType>, CallbackOptions)
    CallbackEventHandler.UnregisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, CallbackOptions)
    CallbackEventHandler.UnregisterAllRemovableCallbacks()
    CallbackEventHandler.HasTrickleDownHandlers()
    CallbackEventHandler.HasBubbleUpHandlers()
    CallbackEventHandler.ExecuteDefaultActionAtTarget(EventBase)
    CallbackEventHandler.HandleEventBubbleUp(EventBase)
    CallbackEventHandler.HandleEventTrickleDown(EventBase)
    CallbackEventHandler.ExecuteDefaultAction(EventBase)
    CallbackEventHandler.NotifyPropertyChanged(in BindingId)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.AppUI.UI
    Assembly: Unity.AppUI.dll
    Syntax
    [UxmlElement]
    public class ObjectPicker : BaseVisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder, INotifyValueChanged<string>
    Remarks

    The picker is frameless by design — no border and no radius of its own — so the host owns the frame and there is no clipped double border at a rounded corner. Compose it inside a Popover, a Dialog or a FloatingWindow, exactly as ColorPicker is composed by ColorField. It is the intended implementation behind ICustomAssetTargetFieldPicker.

    The value is an item id. The empty string is the cleared reference and selects the noneLabel row.

    Example

    var picker = new ObjectPicker
    {
        title = "Select Material",
        items = new List<ObjectPickerItem>
        {
            new ObjectPickerItem { id = "bronze", label = "Bronze", type = "Material", tab = "assets" },
        },
    };
    picker.RegisterValueChangedCallback(evt => Debug.Log(evt.newValue));

    UXML

    <appui:ObjectPicker title="Select Material" show-size-slider="true" show-none="true" />

    Constructors

    ObjectPicker()

    Default constructor.

    Declaration
    public ObjectPicker()

    Fields

    closeButtonUssClassName

    The ObjectPicker close button styling class.

    Declaration
    public const string closeButtonUssClassName = "appui-objectpicker__close-button"
    Field Value
    Type Description
    string

    headerUssClassName

    The ObjectPicker header styling class.

    Declaration
    public const string headerUssClassName = "appui-objectpicker__header"
    Field Value
    Type Description
    string

    listUssClassName

    The ObjectPicker list styling class.

    Declaration
    public const string listUssClassName = "appui-objectpicker__list"
    Field Value
    Type Description
    string

    noResultsUssClassName

    The ObjectPicker empty-results styling class.

    Declaration
    public const string noResultsUssClassName = "appui-objectpicker__no-results"
    Field Value
    Type Description
    string

    noneId

    The id of the cleared reference. Unity's convention, and what the none row selects.

    Declaration
    public const string noneId = ""
    Field Value
    Type Description
    string

    noneRowUssClassName

    The ObjectPicker none-row styling class.

    Declaration
    public const string noneRowUssClassName = "appui-objectpicker__row--none"
    Field Value
    Type Description
    string

    previewUssClassName

    The ObjectPicker preview styling class.

    Declaration
    public const string previewUssClassName = "appui-objectpicker__preview"
    Field Value
    Type Description
    string

    rowLabelUssClassName

    The ObjectPicker row label styling class.

    Declaration
    public const string rowLabelUssClassName = "appui-objectpicker__row__label"
    Field Value
    Type Description
    string

    rowThumbnailUssClassName

    The ObjectPicker row thumbnail styling class.

    Declaration
    public const string rowThumbnailUssClassName = "appui-objectpicker__row__thumbnail"
    Field Value
    Type Description
    string

    rowUssClassName

    The ObjectPicker row styling class.

    Declaration
    public const string rowUssClassName = "appui-objectpicker__row"
    Field Value
    Type Description
    string

    searchUssClassName

    The ObjectPicker search bar styling class.

    Declaration
    public const string searchUssClassName = "appui-objectpicker__search"
    Field Value
    Type Description
    string

    sizeSliderUssClassName

    The ObjectPicker thumbnail-size slider styling class.

    Declaration
    public const string sizeSliderUssClassName = "appui-objectpicker__size-slider"
    Field Value
    Type Description
    string

    splitViewUssClassName

    The ObjectPicker split view styling class.

    Declaration
    public const string splitViewUssClassName = "appui-objectpicker__split-view"
    Field Value
    Type Description
    string

    tabsUssClassName

    The ObjectPicker tabs styling class.

    Declaration
    public const string tabsUssClassName = "appui-objectpicker__tabs"
    Field Value
    Type Description
    string

    thumbSizeUssClassName

    The ObjectPicker thumbnail-size styling class.

    Declaration
    public const string thumbSizeUssClassName = "appui-objectpicker--thumb-"
    Field Value
    Type Description
    string

    titleUssClassName

    The ObjectPicker title styling class.

    Declaration
    public const string titleUssClassName = "appui-objectpicker__title"
    Field Value
    Type Description
    string

    toolbarSlotUssClassName

    The ObjectPicker toolbar slot styling class.

    Declaration
    public const string toolbarSlotUssClassName = "appui-objectpicker__toolbar-slot"
    Field Value
    Type Description
    string

    toolbarUssClassName

    The ObjectPicker toolbar styling class.

    Declaration
    public const string toolbarUssClassName = "appui-objectpicker__toolbar"
    Field Value
    Type Description
    string

    ussClassName

    The ObjectPicker main styling class.

    Declaration
    public const string ussClassName = "appui-objectpicker"
    Field Value
    Type Description
    string

    Properties

    contentContainer

    Logical container where child elements are added. If a child is added to this element, the child is added to this element's content container instead.

    Declaration
    public override VisualElement contentContainer { get; }
    Property Value
    Type Description
    VisualElement
    Overrides
    VisualElement.contentContainer

    currentTab

    The active tab's value, or null when there are no tabs.

    Declaration
    public string currentTab { get; }
    Property Value
    Type Description
    string

    items

    The candidates offered by the picker.

    Declaration
    public IEnumerable<ObjectPickerItem> items { get; }
    Property Value
    Type Description
    IEnumerable<ObjectPickerItem>

    noneIconName

    Icon for the none row.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public string noneIconName { get; set; }
    Property Value
    Type Description
    string
    Remarks

    When set, the row renders like a regular item — icon plus upright, unmuted text — because the field's "none" is a real engine fallback asset rather than an absence. Leave it null for the classic italic placeholder.

    noneLabel

    The label of the none row, and of the cleared selection in the preview.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public string noneLabel { get; set; }
    Property Value
    Type Description
    string
    Remarks

    Lets a field say what "no assignment" actually resolves to — a Text font falling back to the built-in Inter shows "Inter (Default)" rather than the generic placeholder.

    previewElement

    The preview pane. Exposed so a host can override its renderPreview.

    Declaration
    public ObjectPickerPreview previewElement { get; }
    Property Value
    Type Description
    ObjectPickerPreview

    searchBar

    The search bar.

    Declaration
    public SearchBar searchBar { get; }
    Property Value
    Type Description
    SearchBar

    showCloseButton

    Whether a close button is offered in the header, for a windowed picker.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public bool showCloseButton { get; set; }
    Property Value
    Type Description
    bool

    showNone

    Whether the leading none row is offered.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public bool showNone { get; set; }
    Property Value
    Type Description
    bool
    Remarks

    True by default: a Unity-style object field must always offer "no assignment". The row pins to the top of every tab, ignores the search text, and stays selected while value is null or empty.

    showSizeSlider

    Whether the thumbnail-size slider is shown.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public bool showSizeSlider { get; set; }
    Property Value
    Type Description
    bool

    tabsElement

    The tab strip.

    Declaration
    public Tabs tabsElement { get; }
    Property Value
    Type Description
    Tabs

    thumbSize

    The thumbnail size step used by the list rows.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public ObjectPickerThumbSize thumbSize { get; set; }
    Property Value
    Type Description
    ObjectPickerThumbSize

    title

    The header title. Null or empty hides the whole header unless showCloseButton is true.

    Declaration
    [CreateProperty]
    [UxmlAttribute]
    public string title { get; set; }
    Property Value
    Type Description
    string

    toolbarSlot

    The header slot for extra toolbar content, right-aligned beside the size slider.

    Declaration
    public VisualElement toolbarSlot { get; }
    Property Value
    Type Description
    VisualElement

    value

    The selected item's id.

    Declaration
    [CreateProperty]
    public string value { get; set; }
    Property Value
    Type Description
    string

    Methods

    GetThumbSizeUssClassName(ObjectPickerThumbSize)

    Declaration
    public static string GetThumbSizeUssClassName(ObjectPickerThumbSize enumValue)
    Parameters
    Type Name Description
    ObjectPickerThumbSize enumValue
    Returns
    Type Description
    string

    SetItems(IEnumerable<ObjectPickerItem>)

    Replaces the candidate list.

    Declaration
    public void SetItems(IEnumerable<ObjectPickerItem> newItems)
    Parameters
    Type Name Description
    IEnumerable<ObjectPickerItem> newItems

    The new candidates. Null clears the list.

    SetTabs(IEnumerable<ObjectPickerTab>)

    Replaces the tab strip.

    Declaration
    public void SetTabs(IEnumerable<ObjectPickerTab> newTabs)
    Parameters
    Type Name Description
    IEnumerable<ObjectPickerTab> newTabs

    The new tabs. Null or empty hides the strip.

    SetValueWithoutNotify(string)

    Sets the value without sending a change event.

    Declaration
    public void SetValueWithoutNotify(string newValue)
    Parameters
    Type Name Description
    string newValue

    The new selected id.

    Events

    closeRequested

    Raised when the header's close button is pressed. The button is only shown when showCloseButton is true.

    Declaration
    public event Action closeRequested
    Event Type
    Type Description
    Action

    tabChanged

    Raised when the active tab changes, with the new value.

    Declaration
    public event Action<string> tabChanged
    Event Type
    Type Description
    Action<string>

    Implements

    IEventHandler
    IResolvedStyle
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IContextOverrideElement
    IAdditionalDataHolder
    INotifyValueChanged<T>

    Extension Methods

    VisualElementExtensions.FindNavController(VisualElement)
    RegisterUpdateCallbackExtensions.RegisterUpdateCallback(VisualElement, EventCallback<UpdateEvent>)
    RegisterUpdateCallbackExtensions.UnregisterUpdateCallback(VisualElement, EventCallback<UpdateEvent>)
    VisualElementExtensions.EnableDynamicTransform(VisualElement, bool)
    VisualElementExtensions.EnablePicking(VisualElement, bool)
    VisualElementExtensions.GetChildren<T>(VisualElement, bool)
    VisualElementExtensions.GetContextProvider<T>(VisualElement)
    VisualElementExtensions.GetContextProvider<T>(VisualElement, string)
    VisualElementExtensions.GetContext<T>(VisualElement)
    VisualElementExtensions.GetContext<T>(VisualElement, string)
    VisualElementExtensions.GetExclusiveRootElement(VisualElement)
    VisualElementExtensions.GetLastAncestorOfType<T>(VisualElement)
    VisualElementExtensions.GetPreferredTooltipPlacement(VisualElement)
    VisualElementExtensions.GetSelfContext<T>(VisualElement)
    VisualElementExtensions.GetSelfContext<T>(VisualElement, string)
    VisualElementExtensions.GetTooltipContent(VisualElement)
    VisualElementExtensions.GetTooltipTemplate(VisualElement)
    VisualElementExtensions.HasAncestorOfType<T>(VisualElement, bool)
    VisualElementExtensions.HasAncestorsOfType<T>(VisualElement)
    VisualElementExtensions.IsContextProvider<T>(VisualElement)
    VisualElementExtensions.IsContextProvider<T>(VisualElement, string)
    VisualElementExtensions.IsInvisible(VisualElement)
    VisualElementExtensions.IsOnScreen(VisualElement)
    VisualElementExtensions.ProvideContext<T>(VisualElement, string, T)
    VisualElementExtensions.ProvideContext<T>(VisualElement, T)
    VisualElementExtensions.RegisterContextChangedCallback<T>(VisualElement, string, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.RegisterContextChangedCallback<T>(VisualElement, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.SetPreferredTooltipPlacement(VisualElement, OptionalEnum<PopoverPlacement>)
    VisualElementExtensions.SetTooltipContent(VisualElement, VisualElementExtensions.TooltipContentCallback)
    VisualElementExtensions.SetTooltipTemplate(VisualElement, VisualElement)
    VisualElementExtensions.UnregisterContextChangedCallback<T>(VisualElement, string, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.UnregisterContextChangedCallback<T>(VisualElement, EventCallback<ContextChangedEvent<T>>)
    In This Article
    Back to top
    Copyright © 2026 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)