The best solution for drawing vector-based lines in Unity! Vectrosity has much more control and flexibility than the LineRenderer component. Draw all sorts of vectors, grids, graphs, and just plain lines, fast and easy, in 2D or 3D. Get Vectrosity now Version 5.4.2 now available! (Changelog) You'll get an update notice if you bought an older version and have subscribed to update notifications.
- Works on mobile platforms.
- Can make hundreds or thousands of separate lines, each with its own color and width, with only one draw call.
- Lines only need to update when they change, so static lines take no extra CPU time.
- Continuously redrawing lines every frame is still fast, with low-end computers updating over half a million line segments per second.
- Can draw anti-aliased lines without needing FSAA, or make lines glow without needing full-screen image effects.
- Make 3D vector objects that behave like regular game objects. Can be used for various special effects, like the x-ray demo (right).
- Can draw points, too.
- Many built-in functions for drawing splines, curves, circles, rects, and more.
- Can add textures to a line's front, back, or both to make arrows and other shapes.
- Visually edit lines in the scene view.
- Extensive documentation and reference guide to all functions.
- Includes many example scripts and scenes, and the complete project for the retro Tank Zone vector graphics game is included free!
How it works
Vectrosity integrates with the GUI system introduced in Unity 4.6, as either a 2D overlay or as 3D lines drawn in the scene. Once the lines are drawn, they only have to be updated when needed, which makes them very fast.
To make a simple line, just call the VectorLine.SetLine function with a color and at least two points:
VectorLine.SetLine (Color.white, Vector2(100, 50), Vector2(250, 120));
If you want more options, you can make a VectorLine object. First create some points in a Vector2 or Vector3 list, which can be any size up to around 16,000 elements (Vectrosity uses screen space for 2D coordinates and world space for 3D coordinates):
var linePoints = new List.<Vector2>([Vector2(0, 0), Vector2(Screen.width-1, Screen.height-1)]);
Then make a VectorLine object, giving it a name, the points, a texture, and the line width in pixels (there are more optional parameters, but these are the basics):
var myLine = new VectorLine ("Line", linePoints, lineTexture, 2);
Then draw the line:
Presto, you have a 2-pixel-thick line that extends from one corner of the screen to the other. You can update the points and call VectorLine.Draw again whenever you like. You can also use the transform of another object in order to move or rotate lines without having to recompute them.
This is just the start...there are lots more options and functions available to make things easy and to accomplish various effects. Vectrosity is written in C#, but you don’t have to know C# to use it, and the complete functionality is available in any language.
Selection box example
Click for a complete script example of a selection box using Vectrosity. It uses the uniform-scaled texture functionality for animated dashed lines.
Try Tank Zone — it’s a retro Battle Zone remake, with increasing numbers of tanks that’ll keep you on your toes! The complete project is included when you buy Vectrosity.
Check out the line drawing demo. Lines can be any number of pixels thick, and there’s an option to fill in corners or weld joins.
Try the scribblecube demo, which fills the screen with hundreds of rotating, glowing line segments.
There's also the trail demo. This shows a ball that leaves a dotted line trail behind as it bounces around.
Click for another complete script example of a dynamic grid using Vectrosity, where a GUI slider controls the pixel size of each grid square.
See the documentation for more details about how Vectrosity is used. The package also contains a guide to creating lines in the editor, and a complete reference guide to all functions.
Vectrosity requires Unity 5.4 or later. Packages that run on earlier versions of Unity are available upon request (please include your invoice number). Several licenses are available to suit your needs, starting at US$29.95. Source code is included, works on most platforms including mobile.
If you have any questions or comments, you can use one of these methods:
“I bought it myself and while it is super-cheap, its much, much better than what I feel like doing. I have over 20 years of game development code experience and yet buying a vector line solution was the smartest move I've made for a long time.”
“Great product and GREAT support! It has saved hours even days of my time.”
“20 minutes in and I already have my GPS route lines working. It "Just Works", my mind is blown. It's people like you who make me want to come home after a 12 hour day, and spend 6 more playing with Unity.”
See more feedback about Vectrosity and other utilities!