Obi Official Forum
2d Line Renderer Not Updating - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Rope (https://obi.virtualmethodstudio.com/forum/forum-4.html)
+--- Thread: 2d Line Renderer Not Updating (/thread-1593.html)



2d Line Renderer Not Updating - Bluerex - 30-12-2019

Hi,

I am having troubles getting a 2d rope to render. I want to use line renderer to display the rope.
  • Created a new scene
  • Built a new blueprint
  • Added a rope
  • Set the solver to 2d mode
  • Removed the extrude renderer
  • Added a particle attacher to the first control point so it wouldn't fall
  • Added a line renderer
  • Pressed "Play"
The results are weird (gif in link):
https://imgur.com/zBeoiBK

Basically, the Game view doesn't update, but when i click on the "scene" view, it does update... this might be a unity thing?

This is in Obi Rope 5 btw. Any tips on how to fix this? I am using unity 2019.2.3f1


RE: 2d Line Renderer Not Updating - josemendez - 30-12-2019

(30-12-2019, 03:09 AM)Bluerex Wrote: Hi,

I am having troubles getting a 2d rope to render. I want to use line renderer to display the rope.
  • Created a new scene
  • Built a new blueprint
  • Added a rope
  • Set the solver to 2d mode
  • Removed the extrude renderer
  • Added a particle attacher to the first control point so it wouldn't fall
  • Added a line renderer
  • Pressed "Play"
The results are weird (gif in link):
https://imgur.com/zBeoiBK

Basically, the Game view doesn't update, but when i click on the "scene" view, it does update... this might be a unity thing?

This is in Obi Rope 5 btw. Any tips on how to fix this? I am using unity 2019.2.3f1

Hi,

What rendering pipeline are you using?


RE: 2d Line Renderer Not Updating - Bluerex - 30-12-2019

(30-12-2019, 04:33 PM)josemendez Wrote: Hi,

What rendering pipeline are you using?

Lightweight Render Pipeline, the one with the new 2D lighting.


RE: 2d Line Renderer Not Updating - LORDeveloper - 09-01-2020

Same thing here usingĀ 

Unity 2019.3 with Universal Render Pipeline. When I change the length, it doesn't update at all with line render

[attachment=571]
I have clicked on the scene view in order to make the rope render. And it ignores my UV settings.

[attachment=572]
When I press "Play", it just disappears. And I have to click on the scene view again to show again.

[attachment=573]
When I change the length, the rope doesn't get updated.


RE: 2d Line Renderer Not Updating - josemendez - 09-01-2020

(09-01-2020, 11:46 AM)LORDeveloper Wrote: Same thing here usingĀ 

Unity 2019.3 with Universal Render Pipeline. When I change the length, it doesn't update at all with line render


I have clicked on the scene view in order to make the rope render. And it ignores my UV settings.


When I press "Play", it just disappears. And I have to click on the scene view again to show again.


When I change the length, the rope doesn't get updated.

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.


RE: 2d Line Renderer Not Updating - LORDeveloper - 10-01-2020

(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.