With the new Renderer Pipelines, the OnPostRender-callback is gone, which means GL.Lines is gone.

LineRenderer looks terrible (aliases really badly, and scales with distance from camera).

How do I draw UI lines (similar to the editor "grid", solid color, preferably with controllable width)?

  • 3
    \$\begingroup\$ We can't speculate about "why" the Unity development team chose to implement the rendering systems the way they did. Can we rephrase your question to "how" to achieve a specific line effect? For instance, if you want to render an anti-aliased grid like in your example, we have existing Q&A on how to solve that specific problem \$\endgroup\$
    – DMGregory
    Dec 28, 2018 at 22:29

1 Answer 1


GL.Lines are not gone, if using the Scriptable Render Pipeline you can use your GL methods in this event: RenderPipeline.beginCameraRender

void Start(){
  RenderPipeline.beginCameraRendering = OnPostProcess(yourCamera);

void OnPostProcess(Camera camera){
  OnLineRender(Material mat, Vector3 startPos, Vector3 endPos, Color color);

public void OnLineRender(Material mat, Vector3 startPos, Vector3 endPos, Color color)
   RenderPipeline.beginCameraRendering = OnPostProcess(yourCamera)
   GL.modelview = Camera.main.worldToCameraMatrix;


   GL.Vertex3(startPos.x, startPos.y, startPos.z);
   GL.Vertex3(endPos.x, endPos.y, endPos.z);


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .