Search Unity

How to sort render order of Line Renderer per segment?

Discussion in 'General Graphics' started by ManuelMeisen, Nov 26, 2019.

  1. ManuelMeisen

    ManuelMeisen

    Joined:
    Sep 14, 2019
    Posts:
    6
    Is there a way to set the render order of aline renderer by segment (between two points) instead of the whole line? I sorty everything else by y-axis(and layers), but the line renderer seems to sort itself depending on the middle of all its points.
    Untitled.png

    On the upper corner, the line renderer is in front of the wall, on the lower corner, its behind the wall.

    If its not possible to order by segment, I will have to give up on the line renderer alltogether.
    If thats so, does someone know of an asset on the store that fits my needs?

    Here is the line render:

    Untitled2.png
     
  2. Danief_

    Danief_

    Joined:
    Feb 2, 2019
    Posts:
    20
    Did you find a solution for this?
     
  3. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,513
    You can't set multiple sort points but in a case like the OP's you could:
    - set its Order in Layer / Sorting Layer so it's explicitly above below other sprites' order/layer
    - see if you can get away with an opaque material for the line
    - break up a single line into multiple LineRenderers (disgusting)