Search Unity

"Canvas" drawings in editor gui scripts

Discussion in 'Immediate Mode GUI (IMGUI)' started by Wahooney, Oct 16, 2011.

  1. Wahooney

    Wahooney

    Joined:
    Mar 8, 2010
    Posts:
    281
    How does one draw lines, circles, etc. To make advanced GUIs in the unity editor (ala Strumpy Editor, uScript, playMaker)?

    I've looked around and I can't find anything with the terms I'm using. I'm assuming that it's a texture that's being blitted onto the gui, but does one have to write your own anti-aliased line renderers?

    Thanks!
     
  2. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Check out the UnityEditor.Handles class.

    You can use Handles.DrawBezier to draw bezier curves. Play with the texture to get nice looking anti-aliasing.
     
  3. Wahooney

    Wahooney

    Joined:
    Mar 8, 2010
    Posts:
    281
    Hey Alex,

    I'm trying to draw to the EditorWindow, don't Handles operate exclusively in the viewport?
     
  4. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    DrawBezier will draw in an EditorWindow.
     
  5. Wahooney

    Wahooney

    Joined:
    Mar 8, 2010
    Posts:
    281
    Ahhh, it was a scale problem! I was expecting 0.0-1.0 to be bigger than 1 pixel :p

    Thanks, Alex.