docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class DropZone

    A drop zone is a container that can be used to drop content into.

    Inheritance
    object
    CallbackEventHandler
    Focusable
    VisualElement
    BaseVisualElement
    DropZone
    Implements
    IEventHandler
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IResolvedStyle
    IContextOverrideElement
    Inherited Members
    BaseVisualElement.contextPrefix
    BaseVisualElement.scaleOverride
    BaseVisualElement.themeOverride
    BaseVisualElement.langOverride
    BaseVisualElement.layoutDirectionOverride
    BaseVisualElement.preferredTooltipPlacementOverride
    BaseVisualElement.tooltipDelayMsOverride
    BaseVisualElement.GetLayoutDirectionUssClassName(Dir)
    VisualElement.disabledUssClassName
    VisualElement.ExecuteDefaultAction(EventBase)
    VisualElement.Focus()
    VisualElement.SendEvent(EventBase)
    VisualElement.SetEnabledFromHierarchy(bool)
    VisualElement.SetEnabled(bool)
    VisualElement.MarkDirtyRepaint()
    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.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.usageHints
    VisualElement.transform
    VisualElement.layout
    VisualElement.contentRect
    VisualElement.paddingRect
    VisualElement.worldBound
    VisualElement.localBound
    VisualElement.worldTransform
    VisualElement.pickingMode
    VisualElement.name
    VisualElement.enabledInHierarchy
    VisualElement.enabledSelf
    VisualElement.visible
    VisualElement.generateVisualContent
    VisualElement.experimental
    VisualElement.hierarchy
    VisualElement.cacheAsBitmap
    VisualElement.parent
    VisualElement.panel
    VisualElement.visualTreeAssetSource
    VisualElement.this[int]
    VisualElement.childCount
    VisualElement.schedule
    VisualElement.style
    VisualElement.customStyle
    VisualElement.styleSheets
    VisualElement.tooltip
    VisualElement.resolvedStyle
    Focusable.Blur()
    Focusable.focusable
    Focusable.tabIndex
    Focusable.delegatesFocus
    CallbackEventHandler.RegisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.RegisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TrickleDown)
    CallbackEventHandler.HandleEvent(EventBase)
    CallbackEventHandler.HasTrickleDownHandlers()
    CallbackEventHandler.HasBubbleUpHandlers()
    CallbackEventHandler.ExecuteDefaultActionAtTarget(EventBase)
    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
    public class DropZone : BaseVisualElement, IEventHandler, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle, IContextOverrideElement

    Constructors

    DropZone()

    Create a new DropZone.

    Declaration
    public DropZone()

    DropZone(Action)

    Create a new DropZone.

    Declaration
    public DropZone(Action onClick)
    Parameters
    Type Name Description
    Action onClick

    The action to perform when the DropZone is clicked.

    Fields

    backgroundUssClassName

    The DropZone background styling class.

    Declaration
    public const string backgroundUssClassName = "appui-dropzone__background"
    Field Value
    Type Description
    string

    frameUssClassName

    The DropZone frame styling class.

    Declaration
    public const string frameUssClassName = "appui-dropzone__frame"
    Field Value
    Type Description
    string

    stateUssClassName

    The DropZone state styling class.

    Declaration
    public const string stateUssClassName = "appui-dropzone--"
    Field Value
    Type Description
    string

    ussClassName

    The DropZone main styling class.

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

    visibleIndicatorUssClassName

    The DropZone visible indicator styling class.

    Declaration
    public const string visibleIndicatorUssClassName = "appui-dropzone--visible-indicator"
    Field Value
    Type Description
    string

    Properties

    clickable

    The Pressable used to handle click events.

    Declaration
    public Pressable clickable { get; }
    Property Value
    Type Description
    Pressable

    contentContainer

    The container used to display the content.

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

    state

    The state of the DropZone.

    Declaration
    public DropZoneState state { get; set; }
    Property Value
    Type Description
    DropZoneState

    tryGetDroppableFromPath

    Method invoked when a drag is started to find any droppable object(s) that can be dropped on the target using the current drag and drop path data.

    See paths for more information.

    Declaration
    public DropZone.TryGetDroppableFromPathHandler tryGetDroppableFromPath { get; set; }
    Property Value
    Type Description
    DropZone.TryGetDroppableFromPathHandler
    Remarks

    This method will only be called in the Unity Editor, since it relies on the paths property which is not available in Unity Runtime.

    tryGetDroppables

    Method invoked when a drag is started to find any droppable object(s) that can be dropped on the target.

    Declaration
    public DropZone.TryGetDroppablesHandler tryGetDroppables { get; set; }
    Property Value
    Type Description
    DropZone.TryGetDroppablesHandler
    Remarks

    This method will be called in both the Unity Editor and Unity Runtime.

    tryGetDroppablesFromUnityObjects

    Method invoked when a drag is started to find any droppable object(s) that can be dropped on the target using the current drag and drop objects data.

    See objectReferences for more information.

    Declaration
    public DropZone.TryGetDroppablesFromUnityObjectsHandler tryGetDroppablesFromUnityObjects { get; set; }
    Property Value
    Type Description
    DropZone.TryGetDroppablesFromUnityObjectsHandler
    Remarks

    This method will only be called in the Unity Editor, since it relies on the objectReferences property which is not available in Unity Runtime.

    visibleIndicator

    The visible indicator state of the DropZone.

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

    Methods

    GetDropZoneStateUssClassName(DropZoneState)

    Declaration
    public static string GetDropZoneStateUssClassName(DropZoneState enumValue)
    Parameters
    Type Name Description
    DropZoneState enumValue
    Returns
    Type Description
    string

    Events

    dragEnded

    Event fired when the user stops dragging droppable object(s).

    Use this event to perform any cleanup after a drag and drop operation.

    Declaration
    public event Action dragEnded
    Event Type
    Type Description
    Action

    dragStarted

    Event fired when the user starts dragging droppable object(s).

    Use this event to perform validate the drag and drop operation via the state property.

    Declaration
    public event Action dragStarted
    Event Type
    Type Description
    Action

    dropped

    Event fired when the user drops droppable object(s) on the target.

    Declaration
    public event Action<IEnumerable<object>> dropped
    Event Type
    Type Description
    Action<IEnumerable<object>>

    Implements

    IEventHandler
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IResolvedStyle
    IContextOverrideElement

    Extension Methods

    VisualElementExtensions.FindNavController(VisualElement)
    VisualElementExtensions.GetChildren<T>(VisualElement, bool)
    VisualElementExtensions.GetContextProvider<T>(VisualElement)
    VisualElementExtensions.GetContext<T>(VisualElement)
    VisualElementExtensions.GetPreferredTooltipPlacement(VisualElement)
    VisualElementExtensions.GetSelfContext<T>(VisualElement)
    VisualElementExtensions.GetTooltipTemplate(VisualElement)
    VisualElementExtensions.IsContextProvider<T>(VisualElement)
    VisualElementExtensions.ProvideContext<T>(VisualElement, T)
    VisualElementExtensions.RegisterContextChangedCallback<T>(VisualElement, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.SetPreferredTooltipPlacement(VisualElement, OptionalEnum<PopoverPlacement>)
    VisualElementExtensions.SetTooltipTemplate(VisualElement, VisualElement)
    VisualElementExtensions.UnregisterContextChangedCallback<T>(VisualElement, EventCallback<ContextChangedEvent<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)