void HandleNativeDragDropInBottomArea(Editor[] editors, Rect rect) { if (!DraggingOverRect(rect)) { return; } Editor editor = InspectorWindowUtils.GetFirstNonImportInspectorEditor(editors); if (editor == null) { return; } DragAndDrop.visualMode = DragAndDrop.DropOnInspectorWindow(editor.targets, Event.current.type == EventType.DragPerform); if (Event.current.type == EventType.DragPerform) { DragAndDrop.AcceptDrag(); m_TargetIndex = -1; GUIUtility.ExitGUI(); } }
public override void OnGUI(string searchContext) { if (settingsEditor != null) { using (new EditorGUI.DisabledScope(!settingsEditor.IsEnabled())) { using (new SettingsWindow.GUIScope()) settingsEditor.OnInspectorGUI(); // Emulate the Inspector by handling DnD at the native level. var remainingRect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.ExpandHeight(true)); if ((Event.current.type == EventType.DragUpdated || Event.current.type == EventType.DragPerform) && remainingRect.Contains(Event.current.mousePosition)) { DragAndDrop.visualMode = DragAndDrop.DropOnInspectorWindow(new[] { settingsEditor.target }, Event.current.type == EventType.DragPerform); if (Event.current.type == EventType.DragPerform) { DragAndDrop.AcceptDrag(); } } } } base.OnGUI(searchContext); }