Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Drag and Drop Editor window

Discussion in 'Immediate Mode GUI (IMGUI)' started by atholm, Sep 18, 2009.

  1. atholm

    atholm

    Joined:
    Oct 10, 2008
    Posts:
    28
    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
     
  2. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
  3. atholm

    atholm

    Joined:
    Oct 10, 2008
    Posts:
    28
    Thanks I'll look into it.
     
  4. Wolf Dreamer

    Wolf Dreamer

    Joined:
    Sep 2, 2009
    Posts:
    142
    MyEditorWindow.cs causes problems with the line
    Code (csharp):
    1. using UnityEditor;
    2.  
    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
    Code (csharp):
    1.  
    2. 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?
     
  5. jakehaas

    jakehaas

    Joined:
    Aug 17, 2008
    Posts:
    98
    Put the script in a folder called "Editor"
     
  6. Vimalakirti

    Vimalakirti

    Joined:
    Oct 12, 2009
    Posts:
    755
    Last edited by a moderator: Apr 30, 2014
  7. Vimalakirti

    Vimalakirti

    Joined:
    Oct 12, 2009
    Posts:
    755
    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,
     
  8. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,924
    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 :).
     
    Psyco92 likes this.