private static void InputGUI() { Event current = Event.current; if (target) { switch (current.type) { case EventType.DragUpdated: case EventType.DragPerform: if (current.button == 0) { if (DragAndDrop.objectReferences.Length > 0) { if (DragAndDrop.objectReferences[0] is GraphAsset) { if (current.type == EventType.DragPerform) { DragAndDrop.AcceptDrag(); GraphController controller = UndoManager.AddComponent <GraphController>(target); controller.graph = (GraphAsset)DragAndDrop.objectReferences[0]; EditorGUIUtility.PingObject(controller); Selection.activeGameObject = target; set_dirty = true; current.Use(); if (Application.isPlaying) { controller.OnControllerEnable(); } } DragAndDrop.PrepareStartDrag(); } } } break; } } }