docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class DropTarget<T>

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

    Inheritance
    object
    Manipulator
    DropTarget<T>
    Implements
    IManipulator
    Inherited Members
    Manipulator.target
    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 class DropTarget<T> : Manipulator, IManipulator
    Type Parameters
    Name Description
    T

    The type of the object that can be dropped on the target.

    Constructors

    DropTarget()

    Constructor.

    Declaration
    public DropTarget()

    Properties

    isDragging

    True if the user is currently dragging droppable object(s) over the target, false otherwise.

    Declaration
    public bool isDragging { get; }
    Property Value
    Type Description
    bool

    Methods

    GetDroppableObjectForPath(string, out T)

    This method is called when the user drops a file on the target.

    Declaration
    protected virtual bool GetDroppableObjectForPath(string path, out T obj)
    Parameters
    Type Name Description
    string path

    The path of the file dropped on the target.

    T obj

    The object to be dropped.

    Returns
    Type Description
    bool

    True if the object is valid and can be dropped, false otherwise.

    Remarks

    The result will be cached and this cache will be invalidated when the current drag operation ends.

    GetDroppableObjects()

    This method is called to get the objects that can be dropped on the target.

    Declaration
    protected virtual List<T> GetDroppableObjects()
    Returns
    Type Description
    List<T>

    The objects that can be dropped on the target.

    GetDroppableObjectsForUnityObjects(Object[], out List<T>)

    This method is called when the user drops a Unity object on the target.

    Declaration
    protected virtual bool GetDroppableObjectsForUnityObjects(Object[] objects, out List<T> objs)
    Parameters
    Type Name Description
    Object[] objects

    The objects dropped on the target.

    List<T> objs

    The objects to be dropped.

    Returns
    Type Description
    bool

    True if the object is valid and can be dropped, false otherwise.

    RegisterCallbacksOnTarget()

    Called to register event callbacks on the target element.

    Declaration
    protected override void RegisterCallbacksOnTarget()
    Overrides
    Manipulator.RegisterCallbacksOnTarget()

    Reset()

    Reset the DropTarget.

    Declaration
    protected virtual void Reset()

    UnregisterCallbacksFromTarget()

    Called to unregister event callbacks from the target element.

    Declaration
    protected override void UnregisterCallbacksFromTarget()
    Overrides
    Manipulator.UnregisterCallbacksFromTarget()

    Events

    dragEnded

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

    Declaration
    public event Action dragEnded
    Event Type
    Type Description
    Action

    dragStarted

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

    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<T>> dropped
    Event Type
    Type Description
    Action<IEnumerable<T>>

    Implements

    IManipulator
    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)