What is Unity Line Renderer?
The Line Renderer is a component in Unity that allows you to draw lines as if you were using a pen.
With Line Renderer, you can draw very smooth lines as well as complex spiral shapes. It forms your shape by drawing lines between two or more points.
What is the use of Line Renderer?
We can use Line Renderer for making games like One Line where you connect bars to go through sections, in drawing games, and to make games like Road Draw.
Of course, in addition to these, you can find and implement many more game ideas depending on your imagination.
How to Use Line Renderer?
You can add the Line Renderer to an existing object by clicking the "Add Component" button in the "Inspector" menu, or if you wish to create a new object directly, you can follow "Game Object > Effect > Line" to create a LineRenderer object.
When added, you will see a screen like this.
Let's review what the components here do.
At the top, the
(Edit point in scene view) next to the "+" sign allows you to see your points in the editor, and the "+"
(Create point in scene view) sign allows you to draw in the editor.
If we need to explain a bit more; with the symbol to the left of the "+" you can see and edit the points, while with the "+" sign you can add points.
After adding with the + sign, if you switch to Edit mode, your screen will look like this.
Simplify Preview gives you a simplified view.
From the Tolerance section, you can enter as many intervals as there are objects in the Positions section, or rather as many points, and when you click Simplify, it will display the vector difference for you.

Positions here you can set the positions of the points of your shape, and add new points.
Width here we set the thickness of our line; by entering start and end values, we can make one part thicker and another part thinner as we wish.
To add a point, it's enough to double-click the place you want to add in the width panel.
Color you can set any color you want here. You can double-click the Color panel to open the color palette, and if you add as many points to the gradient here as you have in the "Positions" section, your gradient will start from the points. If you add fewer points, your gradient will start from the middle of the points that are left for last.
Corner Vertices this determines how sharp the turns will be; 0 means very sharp turns, and as you increase the number, the turns become less sharp and smoother.
End Cap vertices are the curves of the start and end points.
Alignment sets the direction the line faces; you can set it to face the camera or the Z-axis.
Let me note; the Alignment setting is not useful in 2D games.
Texture Mode is where you adjust how the texture is applied to the line.
- Stretch: The texture appears once along the entire line
- Tile: The texture is applied based on the world width.
- DistributePerSegment: Each corner is placed as if they are of equal length.
- RepeatPerSegment: Repeats from each point.
Shadow Bias can mostly be thought of as the ratio of the shadow to light in 3D games, like the difference between noon and evening shadows.
Generate Lightning Data recreates the lighting according to the objects present in Unity.
Use World Space when enabled, allows the object to be created anywhere in the scene; when disabled, the drawing starts from the center of the object where it's created.
Material here you can assign the materials that will be used for the lines formed during drawing.
Lighting the area where you make light settings.
Probes the area where you adjust settings like light reflection.
Additional Setting this is the section where a few more extensive, extreme settings are made.
- Motion Vectors select what movement will be determined by: camera, object
- Dynamic Occlusion ensures it is not rendered when out of the camera view or not visible.
- Sorting Layer the way layers are ordered
- Order in Layer which layer it will be on
Yes friends, I tried to explain as best as I could. In my next post, I plan to explain how you can create lines with Line Renderer and how we can intervene in Line Renderer with script. See you until then.
A small note: If you are looking for a more detailed documentation about Line Renderer, you can access the Line Renderer section on the Unity Official documentation page from
here.
Yorum Gönder