Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2d Line Renderer Not Updating
#6
(09-01-2020, 03:33 PM)josemendez Wrote: Seems that unlike the built-in pipeline, URPs do not call Camera.onPreCull. Since the line renderer relies on this callback to render the view-dependent mesh, in URP it is not drawn.

Instead, URP calls RenderPipelineManager.beginCameraRendering.

In ObiRopeLineRenderer.cs, declare a renderCallback delegate:
Code:
System.Action<ScriptableRenderContext, Camera> renderCallback;

Replace "Camera.onPreCull += UpdateRenderer;" in ObiRopeLineRenderer.cs OnEnable() method with this:

Code:
renderCallback = new System.Action<ScriptableRenderContext, Camera>((cntxt, cam) => { UpdateRenderer(cam); });
RenderPipelineManager.beginCameraRendering += renderCallback;

And similarly, replace "Camera.onPreCull -= UpdateRenderer;" in OnDisable with this:
Code:
RenderPipelineManager.beginCameraRendering -= renderCallback;

That should get rid of the issue. Will include this fix in the next update.

Thanks, that works. Don't forget to put Using UnityEngine.Rendering at the top.
Reply


Messages In This Thread
2d Line Renderer Not Updating - by Bluerex - 30-12-2019, 03:09 AM
RE: 2d Line Renderer Not Updating - by josemendez - 30-12-2019, 04:33 PM
RE: 2d Line Renderer Not Updating - by Bluerex - 30-12-2019, 10:35 PM
RE: 2d Line Renderer Not Updating - by josemendez - 09-01-2020, 03:33 PM
RE: 2d Line Renderer Not Updating - by LORDeveloper - 10-01-2020, 03:16 PM