private void DrawSoundDatabaseDropZone(SoundDatabase soundDatabase) { GUILayout.Label(GUIContent.none, GUILayout.ExpandWidth(true), GUILayout.Height(0)); Rect lastRect = GUILayoutUtility.GetLastRect(); var dropRect = new Rect(lastRect.x + DGUI.Properties.Space(), lastRect.y - 2, DGUI.Properties.DefaultFieldWidth * 5, DGUI.Properties.SingleLineHeight); //calculate rect bool containsMouse = dropRect.Contains(Event.current.mousePosition); if (containsMouse) { DGUI.Colors.SetNormalGUIColorAlpha(); switch (Event.current.type) { case EventType.DragUpdated: bool containsAudioClip = DragAndDrop.objectReferences.OfType <AudioClip>().Any(); DragAndDrop.visualMode = containsAudioClip ? DragAndDropVisualMode.Copy : DragAndDropVisualMode.Rejected; Event.current.Use(); Repaint(); break; case EventType.DragPerform: IEnumerable <AudioClip> audioClips = DragAndDrop.objectReferences.OfType <AudioClip>(); bool undoRecorded = false; foreach (AudioClip audioClip in audioClips) { if (!undoRecorded) { DoozyUtils.UndoRecordObject(soundDatabase, UILabels.AddSounds); undoRecorded = true; } SoundGroupData soundGroupData = soundDatabase.Add(audioClip.name, false, false); soundGroupData.Sounds.Add(new AudioData(audioClip)); soundGroupData.SetDirty(false); soundDatabase.SetDirty(false); m_needsSave = true; } Event.current.Use(); Repaint(); break; } } DGUI.Doozy.DrawDropZone(dropRect, containsMouse); GUILayout.Space(dropRect.width); }