Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

line drawing

Discussion in 'Immediate Mode GUI (IMGUI)' started by Ryuuguu, Nov 10, 2007.

  1. Ryuuguu

    Ryuuguu

    Joined:
    Apr 14, 2007
    Posts:
    382
    Is there any way to draw an arbitry line from x1,y1 to x2,y2?
    I currently need a squaregrid so i am using a bunch of GUI.box, but I wondering if there is another more general way.

    Cheers,
    Grant
     
  2. seon

    seon

    Joined:
    Jan 10, 2007
    Posts:
    1,441
    Yes, use a line renderer.

    Its designed to draw between points of vector3, but you could translate it to screen co-ordinates and draw whatever shapes you like... it works like a chain of polylines.
     
  3. Ryuuguu

    Ryuuguu

    Joined:
    Apr 14, 2007
    Posts:
    382
    I'll try that thanks. Using GUI.Box did not work out. I was still wondering if there is a way to draw an arbitray line in the GUI layers.

    Cheers,
    Grant
     
  4. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    I don't believe you can do that (draw lines using the new GUI tools).
     
  5. shaun

    shaun

    Joined:
    Mar 23, 2007
    Posts:
    728
    Tom's right. If I'm not mistaken the lines drawn using the linerender will always be behind the GUI.

    I would like a function similar that in Flash that allows you to draw a weighted bezier curve between two points. I don't know if this could be done with some OpenGL trickery - one of the UT gfx guys would though.