LineRenderer really janky in 3D

So I’ve set a LineRenderer to just draw a little square that I can rotate with the mouse in game, but as I rotate it around it jumps to different angles and is never really perfectly straight, plus from the side it always looks awful. I just want it to appear as a line of a certain width from any angle, dunno really what I’m doing wrong, should I be rendering it as an immovable object in front of the camera and line up the corners with raycasting? Seems like it shouldn’t be that hard. At lower line widths it looks less janky but from the sides it is very thin, like it’s drawn on a flat surface, maybe that is just how it is.

Images below show only a small rotation but a huge change in geometry, how can I fix this?


It does indeed have some problems, especially in 3D.

You could submit a bug, and we would see if it can be improved.

An alternative is an asset store package, such as Shapes | Particles/Effects | Unity Asset Store

There is another good one too but I forget it’s name…

Unity’s line renderer doesn’t handle sharp corners very well. You can get slightly better lines by increasing the corner vertices a little, but then you’ll get rounded corners.

The main issue is its essentially an unsolvable problem in the general case. If you want sharp corners, but also a consistently wide line, eventually the miter joint shoots out to infinity as the lines approach being parallel. The rounded corners you get when increase the corner vertices may not be the look you want, but it will fix the lines being a constant width in screen space.

Note: other line rendering assets, like Shapes, will work better in terms of keeping the lines constant width, but at the “cost” of the corners potentially getting very, very long. I’ve used some line rendering systems in the past that have an angle cutoff for when it switches from miter to rounded or clipped corners, but Unity’s built in Line Renderer doesn’t have this option, and I don’t know of any on the store that can do that either.

1 Like