Advertisement
Guest User

Node Editor Framework - Drag and Drop

a guest
Jan 30th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. [EventHandlerAttribute(EventType.DragUpdated)]
  2. public static void HandleDragUpdated(NodeEditorInputInfo inputInfo)
  3. {
  4.     if (DragAndDrop.objectReferences[0].GetType() == typeof(SceneAsset))
  5.     {
  6.         DragAndDrop.AcceptDrag();
  7.         DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
  8.     }
  9. }
  10.  
  11. [EventHandlerAttribute(EventType.DragPerform)]
  12. public static void HandleDragPerform(NodeEditorInputInfo inputInfo)
  13. {
  14.     inputInfo.SetAsCurrentEnvironment();
  15.     MyNode newNode = Node.Create("myNode", NodeEditor.ScreenToCanvasSpace(inputInfo.inputPos)) as MyNode;
  16.  
  17.     newNode.someText = DragAndDrop.objectReferences[0].name;
  18. }
  19.  
  20. [EventHandlerAttribute(EventType.DragExited)]
  21. public static void HandleDragExited(NodeEditorInputInfo inputInfo)
  22. {
  23.     //This method never gets called??
  24.     Debug.Log("Drag EXITED");
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement