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.
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. |
Start Color | Color at the first line position. Note: This has no effect unless the attached material uses a vertex shader. |
End Color | Color at the last line position. Note: This has no effect unless the attached material uses a vertex shader. |
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. |
To create a Line Renderer: