A list of some of the most notable features in the package
Draw boxes, spheres, cylinders, arcs, bezier curves and many other things easily with minimal code.
ALINE is used by the A* Pathfinding Project - the most popular AI package in the Asset Store for years - to draw gizmos with high performance and quality.
Avoid having to deal with Unity's multiple and incompatible APIs for drawing. The ALINE package uses a single full-featured API everywhere.
Have you ever wanted to draw debug lines from inside ECS or the Unity Job System? Now you can! You can draw everything from inside jobs, even when compiled with Burst and in parallel using IJobForEach.
In the video you can see 10000 boxes drawn each frame from a burst job at several hundred fps.
The API can be easily used in a standalone game as well. This can be very useful if you for example have a custom level editor in your game, or if you are going for a sci-fi look and need pixel-perfect anti-aliased lines.
You get the same high performance and ease of use as in the editor.
This package often outperforms Unity's APIs significantly.
Make sure all those debug lines do not slow down the development of your game!
The plot shows a benchmark in which 10000 random lines were drawn each frame with random colors.
var a = new Vector3(0, 0, 0);
var b = new Vector3(1, 1, 1);
// Draw a line from a to b
Draw.Line(a, b, Color.red);
// Draw a blue wire box with a size of 1
Draw.WireBox(a, Quaternion.identity, 1, Color.blue);
// Draw all enclosed commands relative to the given object
using(Draw.InLocalSpace(transform)) {
// Draw a white cylinder at the transform's pivot
// with a height of 2 and a radius of 0.5
Draw.WireCylinder(Vector3.zero, Vector3.up, 2, 0.5f);
}
To the left you can see an example of how the API can be used.
Where possible the API has been kept similar to Unity's existing APIs to make it easy to migrate. The API is follows a predictable and consistent naming scheme and all commands have the same overloads (e.g. you can always add a color parameter at the end of a function call to draw using that color).
// Draw three red cubes
using (Draw.WithColor(Color.red)) {
Draw.WireBox(Vector3.zero, 1*Vector3.one);
Draw.WireBox(Vector3.zero, 2*Vector3.one);
Draw.WireBox(Vector3.zero, 3*Vector3.one);
}
// Draw a box relative to the object.
// This means it will move, rotate and scale
// with the object.
using (Draw.InLocalSpace(transform)) {
Draw.WireBox(Vector3.zero, Vector3.one);
}
Easily make a number of drawing commands draw using a particular color, or with a given matrix, without having to add extra method parameters everywhere. Using scopes instead of global static variables leads to code that is easier to reason about and the potential for bugs due to the state of the global variables persisting is lowered significantly.
See Scopes for more details.
If you draw something curved (e.g. a wire sphere) then the system automatically determines a reasonable number of vertices to use for it depending on the camera it is rendered for. This ensures that even if you have thousands of curves in the scene view the vertex count will stay reasonable and curves will be smooth even if you zoom in very close to them. In contrast, Unity's APIs use a fixed vertex count regardless of how far away from the camera the curve is.
Lines are drawn with smooth high quality anti-aliasing at all times, even when your game does not use multi-sampling or other anti-aliasing techniques. This is even true in the Unity scene view without any additional post-processing steps. Anti-aliased lines look nicer and if you are going to draw lines in a released game they are a must.
Click on the image to view it at an accurate size.
Out of the box support for both Unity's built-in renderer as well as the High Definition Render Pipeline and the Universal Render Pipeline.