Drag and Drop Editor window

Hi
I’m trying to figure out how DragAndDrop works.
I want to drag a simple object like a rectangle, but as GUI objects does not contains any reference, then I have no idea how to use DragAndDrop.objectReferences. I have tried to use GUIText and GUITexture but they does not seem to work in editor scripts.
Thanks

http://angryant.com/2009/09/18/gui-drag-drop/

Thanks I’ll look into it.

MyEditorWindow.cs causes problems with the line

using UnityEditor;

Assets/My Scripts/Angry Ant’s draganddrop code/MyEditorWindow.cs(8,31): error CS0246: The type or namespace name `EditorWindow’ could not be found. Are you missing a using directive or an assembly reference?

If I comment it out then I get a problem with

public class MyEditorWindow : EditorWindow

Assets/My Scripts/Angry Ant’s draganddrop code/MyEditorWindow.cs(8,31): error CS0246: The type or namespace name `EditorWindow’ could not be found. Are you missing a using directive or an assembly reference?

Was UnityEditor changed in name? What am I doing wrong here?

Put the script in a folder called “Editor”

Angry Ant == Rock Star

Great work, Angry Ant!

I need a bunch of gui elements in a smaller space, so I will have them arranged vertically in a GUIArea with a Scroll Bar.

Can Angry Ant’s draggable Gui Objects be used somehow with that type of automatic formatting or will I need to write my own scrollbar arrangement?

Thanks,

Hmm. AngryAnt’s blog seems to have deleted all the source code. Good example of why it’s a good idea to copy/paste the source into an answer :).

1 Like