void HandleDragAndDrop() { Rect dragRect = Window.position; dragRect.x = 0; dragRect.y = 0; if (dragRect.Contains(Event.current.mousePosition)) { if (Event.current.type == EventType.DragUpdated) { DragAndDrop.visualMode = DragAndDropVisualMode.Copy; Event.current.Use(); } else if (Event.current.type == EventType.DragPerform) { List <AudioClip> duplicates = new List <AudioClip>(); for (int i = 0; i < DragAndDrop.objectReferences.Length; i++) { string filePath = AssetDatabase.GetAssetPath(DragAndDrop.objectReferences[i]); var clips = JSAMEditorHelper.ImportAssetsOrFoldersAtPath <AudioClip>(filePath); for (int j = 0; j < clips.Count; j++) { if (asset.files.Contains(clips[j])) { duplicates.Add(clips[j]); continue; } files.AddNewArrayElement().objectReferenceValue = clips[j]; } } Event.current.Use(); if (duplicates.Count > 0) { string multiLine = string.Empty; for (int i = 0; i < duplicates.Count; i++) { multiLine = duplicates[i].name + "\n"; } EditorUtility.DisplayDialog("Duplicate Audio Clips!", "The following Audio File Objects are already present in the wizard and have been skipped.\n" + multiLine, "OK"); } if (serializedObject.hasModifiedProperties) { serializedObject.ApplyModifiedProperties(); Window.Repaint(); } } } }