DragAndDropHandler<T> Delegate

Summary

[Editor-Only] Delegate for validating and responding to UnityEditor.DragAndDrop operations.
Assembly
Animancer.dll
Namespace
Animancer.Editor
Base Types
  • MulticastDelegate
graph BT Type-->Base0["MulticastDelegate"] Type["DragAndDropHandler<T>"] class Type type-node

Syntax

public delegate bool DragAndDropHandler<T>(T dragging, bool isDrop) : MulticastDelegate 
    where T : class

Remarks

Example:
private DragAndDropHandler<AnimationClip> _AnimationDropHandler;

void OnGUI(Rect area)
{
    _AnimationDropHandler ??= (clip, isDrop) =>
    {
        if (clip.legacy)// Reject legacy animations
            return false;
            
        if (isDrop)// Only act when dropping.
            Debug.Log(clip + " was dropped");
    
        return true;// Drag or drop is accepted.
    };
    
    _AnimationDropHandler.Handle(area);
}

Type Parameters

Name Description
T

Extension Methods

Name Value Summary
Handle<T>(IEnumerable, bool, DragAndDropVisualMode) bool
Handles the current event.
Handle<T>(Rect, DragAndDropVisualMode) bool
Handles the current event.