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.
Property: | Function: |
---|---|
Materials | The first material from this list is used to render the lines. |
Positions | Array of Vector3 points to connect. |
Size | The number of segments in this line. |
Parameters | 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. |
End Color | Color at the last line position. |
Use World Space | If enabled, the object’s position is ignored, and the lines are rendered around world origin. |
To create a line renderer: