public static T ObjectSelectorDragDrop <T>(Rect r, string message, string filter = "") where T : class
        {
            r = EditorGUI.IndentedRect(r);
            int   controlId      = EditorGUIUtility.GetControlID(FocusType.Passive, r);
            T     objectToReturn = default(T);
            Color bgColor        = EditorGUIUtility.isProSkin ? JEditorCommon.darkGrey : JEditorCommon.lightGrey;


            EditorGUI.DrawRect(r, bgColor);
            JEditorCommon.DrawOutlineBox(r, JEditorCommon.midGrey);

            Rect messageRect = new Rect();

            messageRect.size   = new Vector2(r.width, 12);
            messageRect.center = r.center - Vector2.up * (messageRect.size.y * 0.5f + 2);
            EditorGUI.LabelField(messageRect, message, JEditorCommon.CenteredLabel);

            Rect buttonRect = new Rect();

            buttonRect.size   = new Vector2(47, 15);
            buttonRect.center = r.center + Vector2.up * (buttonRect.size.y * 0.5f + 2);
            if (GUI.Button(buttonRect, "Browse", JEditorCommon.CenteredLabel))
            {
                EditorGUIUtility.ShowObjectPicker <Object>(null, false, filter, controlId);
            }
            JEditorCommon.DrawLine(
                new Vector2(buttonRect.min.x, buttonRect.max.y),
                new Vector2(buttonRect.max.x, buttonRect.max.y),
                CenteredLabel.normal.textColor);
            EditorGUIUtility.AddCursorRect(buttonRect, MouseCursor.Link);

            Event e = Event.current;

            if (e != null &&
                r.Contains(e.mousePosition) &&
                (e.type == EventType.DragUpdated ||
                 e.type == EventType.Repaint))
            {
                Object[] draggedObject = DragAndDrop.objectReferences;
                if (draggedObject.Length == 1 &&
                    draggedObject[0] is T)
                {
                    DragAndDrop.AcceptDrag();
                    DragAndDrop.visualMode      = DragAndDropVisualMode.Copy;
                    DragAndDrop.activeControlID = controlId;
                    EditorGUI.DrawRect(r, JUtilities.GetColor(JEditorCommon.selectedItemColor, 0.5f));
                    JEditorCommon.DrawOutlineBox(r, JEditorCommon.selectedItemColor);
                }
            }
            else if (e != null && e.type == EventType.DragPerform && r.Contains(e.mousePosition))
            {
                Object[] draggedObject = DragAndDrop.objectReferences;
                if (draggedObject.Length == 1 &&
                    draggedObject[0] is T)
                {
                    objectToReturn = draggedObject[0] as T;
                }
            }
            else if (e != null && e.type == EventType.ExecuteCommand && e.commandName.Equals("ObjectSelectorClosed"))
            {
                int    id = EditorGUIUtility.GetObjectPickerControlID();
                Object o  = EditorGUIUtility.GetObjectPickerObject();
                if (id == controlId && o != null)
                {
                    objectToReturn = o as T;
                }
            }

            return(objectToReturn);
        }