Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2d Line Renderer Not Updating
#1
Exclamación 
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
Reply
#2
(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?
Reply
#3
(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.
Reply
#4
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.
Reply
#5
(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.
Reply
#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