Version 3.3.0.1

DragAndDropUtilities class

Namespace: Sirenix.Utilities.Editor
Assembly: Sirenix.Utilities.Editor
public static class DragAndDropUtilities
Drag and drop utilities for both Unity and non-unity objects.
Inheritance
  • System.Object
  • DragAndDropUtilities

Properties

CurrentDragId
Gets the currently dragging identifier.
public static int CurrentDragId { get; }
CurrentDropId
Gets the current hovering drop zone identifier.
public static int CurrentDropId { get; }
HoveringAcceptedDropZone
Gets the hovering accepted drop zone ID.
public static int HoveringAcceptedDropZone { get; }
IsDragging
Gets a value indicating whether an instance is currently being dragged.
public static bool IsDragging { get; }
MouseDragOffset
Gets the delta position between the currrent mouse position and where the last drag originated from.
public static Vector2 MouseDragOffset { get; }
OnDragStartMouseScreenPos
Gets the position from where the last drag started from in screen space.
public static Vector2 OnDragStartMouseScreenPos { get; }
PrevDragAndDropId
public static int PrevDragAndDropId { get; }

Methods

DisallowedDropAreaForNextDragZone(Rect)
Disalloweds the drop area for next drag zone. Follow this function call by a DragZone.
public static void DisallowedDropAreaForNextDragZone(Rect rect)
Parameters
UnityEngine.Rect rect

DragAndDropZone(Rect, Object, Type, Boolean, Boolean)
A draggable zone for both Unity and non-unity objects.
public static object DragAndDropZone(Rect rect, object value, Type type, bool allowMove, bool allowSwap)
Parameters
UnityEngine.Rect rect

System.Object value

System.Type type

System.Boolean allowMove

System.Boolean allowSwap

Returns
System.Object

DragZone(Rect, Object, Type, Boolean, Boolean)
A draggable zone for both Unity and non-unity objects.
public static object DragZone(Rect rect, object value, Type type, bool allowMove, bool allowSwap)
Parameters
UnityEngine.Rect rect

System.Object value

System.Type type

System.Boolean allowMove

System.Boolean allowSwap

Returns
System.Object

DragZone(Rect, Object, Type, Boolean, Boolean, Int32)
A draggable zone for both Unity and non-unity objects.
public static object DragZone(Rect rect, object value, Type type, bool allowMove, bool allowSwap, int id)
Parameters
UnityEngine.Rect rect

System.Object value

System.Type type

System.Boolean allowMove

System.Boolean allowSwap

System.Int32 id

Returns
System.Object

DragZone<T>(Rect, T, Boolean, Boolean)
A draggable zone for both Unity and non-unity objects.
public static T DragZone<T>(Rect rect, T value, bool allowMove, bool allowSwap)
Parameters
UnityEngine.Rect rect

T value

System.Boolean allowMove

System.Boolean allowSwap

Returns
T

Type Parameters
T

DragZone<T>(Rect, T, Boolean, Boolean, Int32)
A draggable zone for both Unity and non-unity objects.
public static T DragZone<T>(Rect rect, T value, bool allowMove, bool allowSwap, int id)
Parameters
UnityEngine.Rect rect

T value

System.Boolean allowMove

System.Boolean allowSwap

System.Int32 id

Returns
T

Type Parameters
T

DrawDropZone(Rect, Object, GUIContent, Int32)
Draws the graphics for a DropZone.
public static void DrawDropZone(Rect rect, object value, GUIContent label, int id)
Parameters
UnityEngine.Rect rect

System.Object value

UnityEngine.GUIContent label

System.Int32 id

DrawDropZone(Rect, Texture, GUIContent, Int32)
Draws the graphics for a DropZone.
public static void DrawDropZone(Rect rect, Texture preview, GUIContent label, int id)
Parameters
UnityEngine.Rect rect

UnityEngine.Texture preview

UnityEngine.GUIContent label

System.Int32 id

DropZone(Rect, Object, Type)
A drop zone area for bot Unity and non-unity objects.
public static object DropZone(Rect rect, object value, Type type)
Parameters
UnityEngine.Rect rect

System.Object value

System.Type type

Returns
System.Object

DropZone(Rect, Object, Type, Boolean)
A drop zone area for bot Unity and non-unity objects.
public static object DropZone(Rect rect, object value, Type type, bool allowSceneObjects)
Parameters
UnityEngine.Rect rect

System.Object value

System.Type type

System.Boolean allowSceneObjects

Returns
System.Object

DropZone(Rect, Object, Type, Boolean, Int32)
A drop zone area for bot Unity and non-unity objects.
public static object DropZone(Rect rect, object value, Type type, bool allowSceneObjects, int id)
Parameters
UnityEngine.Rect rect

System.Object value

System.Type type

System.Boolean allowSceneObjects

System.Int32 id

Returns
System.Object

DropZone(Rect, Object, Type, Int32)
A drop zone area for bot Unity and non-unity objects.
public static object DropZone(Rect rect, object value, Type type, int id)
Parameters
UnityEngine.Rect rect

System.Object value

System.Type type

System.Int32 id

Returns
System.Object

DropZone<T>(Rect, T)
A drop zone area for bot Unity and non-unity objects.
public static T DropZone<T>(Rect rect, T value)
Parameters
UnityEngine.Rect rect

T value

Returns
T

Type Parameters
T

DropZone<T>(Rect, T, Boolean)
A drop zone area for bot Unity and non-unity objects.
public static T DropZone<T>(Rect rect, T value, bool allowSceneObjects)
Parameters
UnityEngine.Rect rect

T value

System.Boolean allowSceneObjects

Returns
T

Type Parameters
T

DropZone<T>(Rect, T, Boolean, Int32)
A drop zone area for bot Unity and non-unity objects.
public static T DropZone<T>(Rect rect, T value, bool allowSceneObjects, int id)
Parameters
UnityEngine.Rect rect

T value

System.Boolean allowSceneObjects

System.Int32 id

Returns
T

Type Parameters
T

DropZone<T>(Rect, T, Int32)
A drop zone area for bot Unity and non-unity objects.
public static T DropZone<T>(Rect rect, T value, int id)
Parameters
UnityEngine.Rect rect

T value

System.Int32 id

Returns
T

Type Parameters
T

GetDragAndDropId(Rect)
Gets a more percistent id for drag and drop.
public static int GetDragAndDropId(Rect rect)
Parameters
UnityEngine.Rect rect

Returns
System.Int32

ObjectPickerZone(Rect, Object, Type, Boolean, Int32)
Draws a objectpicker button in the given rect. This one is designed to look good on top of DrawDropZone().
public static object ObjectPickerZone(Rect rect, object value, Type type, bool allowSceneObjects, int id)
Parameters
UnityEngine.Rect rect

System.Object value

System.Type type

System.Boolean allowSceneObjects

System.Int32 id

Returns
System.Object

ObjectPickerZone<T>(Rect, T, Boolean, Int32)
Draws a objectpicker butter, in the given rect. This one is designed to look good on top of DrawDropZone().
public static T ObjectPickerZone<T>(Rect rect, T value, bool allowSceneObjects, int id)
Parameters
UnityEngine.Rect rect

T value

System.Boolean allowSceneObjects

System.Int32 id

Returns
T

Type Parameters
T

PrevDragZoneWasClicked()
public static bool PrevDragZoneWasClicked()
Returns
System.Boolean