How efficient is Line Renderer?

Hi guys,

I was trying out the line renderers for one of my games. They kind of look cool, barring the rumours that I heard from some of the guys, saying that it is not an efficient way to draw lines. I was also using a material for these line objects. What do you guys think about it?

Hi,

How many lines you will have at max.?

10 lines with two vertices per scene after which I destroy them…

I’d say use them unless they cause you issues. I use many line renderers and have never had a performance issues due to them (yet).

I drive my car to work, some guys tell me that riding a motor bike is more efficient, yet I continue to use my car without issue :slight_smile:

Apologies for the crap analogy.

3 Likes

Thanks for the reply guys. I too have not faced an issue yet with Line renderers. Will update if I come across any. Cheers
P.S. Nice analogy though @larku

LineRenderer is ok but if you have more than 2 vertices in the same line, it will look better if you create an object per each pair of vertices.

Sorry!

I didnt get you. Can you please elaborate a bit?

Yes.

You can add a LineRenderer component with 2 or more vertices (points), so a continuos line will be drawn that pass through all points. The problem with this approach is that current implementation makes the line appear twisted on each corner if they are too oblique.

To prevent that ugly effect, if you want to draw a continuous line with more than 2 vertices, you should break down the line into segments per each 2 points. So if you have 5 points, you create 4 GameObjects each one with a LineRenderer attached just with 2 vertices (1-2, 2-3, 3-4, 4-5). This way the line will appear smoothly continuous.

4 Likes

Ah now i get it. Makes sense. Thanks for that tip!

If anything the destroying will be the slow part, as opposed to pooling the data required to render them. 10? Try a thousand then worry the forum about it :stuck_out_tongue:

I’m not sure if I would need that much :wink: Good to know its all fine though.

For more flexible and controllable lines/splines I recommend the cheap and excellent Vectrosity. I used it in Physynth as well.

Yea… Came across that, will definitely buy it in case I need more than just a line renderer with collider.