Legacy Documentation: Version 5.4
Flare
Trail Renderer

Line Renderer

Switch to Scripting

The Line Renderer component 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 therefore 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-wide lines. It renders billboard lines (polygons that always face the camera) that have a width in world units and can be textured. It uses the same algorithm for line rendering as the Trail Renderer.

Properties

Property: Function:
Cast Shadows Determines whether the line casts shadows, whether they should be cast from one or both sides of the line, or whether the line should only cast shadows and not otherwise be drawn. See Renderer-shadowCastingMode in the Script Ref to learn more.
Recieve Shadows If enabled, the line receives shadows.
Materials These properties describe an array of Materials used for rendering the line. The line will be drawn once for each material in the array.
Use Light Probes Check this box to enable Light Probes on the line.
Light Probe Anchor If set, this will be used as the interpolation point instead of the Transform position.
Positions These properties decribe an array of Vector3 points to connect.
        Size The number of segments in this line.
Parameters These properties describe a list of parameters for each line.
        StartWidth Width at the first line position.
        EndWidth Width at the last line position.
Light Probes Probe-based lighting interpolation mode.
Reflection Probes If enabled and reflection probes are present in the Scene, a reflection Texture is picked for this Line Renderer and set as a built-in Shader uniform variable.
Use World Space If enabled, the points are considered as world-space coordinates, instead of being subject to the transform of the GameObject to which this component is attached.

Details

To create a Line Renderer:

  1. In the Unity menu bar, go to GameObject > Create Empty
  2. In the Unity menu bar, go to Component > Effects > Line Renderer
  3. Drag a Texture or Material onto the Line Renderer. It looks best if you use a particle Shader in the Material.

Hints

  • Line Renderers are useful for effects where 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.
Flare
Trail Renderer