- Home /
Draw a Vector line ???
Hi guys ! I'm wondering how to draw and control a vector line (like in Illustrator) with scripting ?
I hope you understand what I mean, and someone knows how to make it.. Thanks in advance !
Answer by valyard · Nov 06, 2012 at 06:08 PM
If not for debug purposes drawing a vector line in Unity is not easy actually.
Debug.Line can be used for debugging, GL.Begin(GL.LINES) is ugly and you can't control lines' material nor lines' thickness.
The easiest way is Vectrosity plugin. For drawing lines with custom materials it is really good. Check out Vectrosity's docs there are script examples. You can't use it to draw lots of lines though. For this purpose you must use custom shader tricks found here.
GL.Begin(GL.LINES) allows you to control material. So if you don't need thick lines then GL lines might be better (at least from performance perspective).
Actually not, or at least it depends; GL.Lines is immediate mode, so you have to redraw it every frame, whereas Vectrosity creates a mesh, so whenever the line doesn't need updating then it doesn't need to be redrawn.
Answer by TK5005 · Nov 06, 2012 at 06:59 PM
I use Vectrocity from the asset store to do all my vector line work. It has a great API and is easy to get up and running with.
Answer by Paulius-Liekis · Nov 06, 2012 at 02:29 PM
Use Debug.Line or GL.Begin(Lines) for drawing lines. For Curve math-logic I guess you will have to google it.