Manual     Reference     Scripting   
  
Reference Manual > Components > Particle Components > Line Renderer Switch to Scripting   

Line Renderer

The Line Renderer takes an array of two or more points in 3D space and draws a straight line between each one. A single Line Renderer Component can thus be used to draw anything from a simple straight line, to a complex spiral. The line is always continuous; if you need to draw two or more completely separate lines, you should use multiple GameObjects, each with its own Line Renderer.

The Line Renderer does not render one pixel thin lines. It renders billboard lines that have width and can be textured. It uses the same algorithm for line rendering as the Trail Renderer.


The Line Renderer Inspector

Properties

MaterialsThe first material from this list is used to render the lines.
PositionsArray of Vector3 points to connect.
SizeThe number of segments in this line.
ParametersList of parameters for each line:
StartWidthWidth at the first line position.
EndWidthWidth at the last line position.
Start ColorColor at the first line position.
End ColorColor at the last line position.
Use World SpaceIf enabled, the object's position is ignored, and the lines are rendered around world origin.

Details

To create a line renderer:

  1. Choose GameObject->Create Empty
  2. Choose Component->Miscellaneous->Line Renderer
  3. Drag a texture or Material on the Line Renderer. It looks best if you use a particle shader in the Material.

Hints

  • Line Renderers are good to use for effects when you need to lay out all the vertices in one frame.
  • The lines may seem to rotate as you move the Camera. This is intentional.
  • The Line Renderer should be the only Renderer on a GameObject.