How can I draw a line with unity2d, and make sure the line not cover the object?

I create a project under unity2D mode, then I use NGUI to create a sprite.
What I want to do is that I draw a line when I move my flinger.

I use VectorLine to do it. Part of the code as shown below

Vector2[] linePoints = pathPoints.ToArray ();

mPathLine = new VectorLine(“Line”, linePoints, myMaterial, 6.8f * mUIRate, LineType.Continuous, Joins.Weld);

mPathLine.Draw ();

But the line may cover the sprite object. What should I do?

I’m not familiar with the VectorLine class, but I would suspect it is using the GL drawing functions to draw the line. Unfortunately, all GL drawing is done AFTER the scene has been renderered, so everything drawn with GL, just goes on top.

You could use the builtin LineRenderer component, but sadly it does not have an option to draw single-pixel lines: the width of the line is defined in local or world coordinates. (it actually creates a MESH)