Error "You can only call cameraDepthTarget inside the scope of a ScriptableRenderPass" in console

I am working on a VR project in the urp, currently using unity 2020.2.6f1 (cannot upgrade to LTS yet due to dependancies).
My console is full of the warning

You can only call cameraDepthTarget inside the scope of a ScriptableRenderPass. Otherwise the pipeline camera target texture might have not been created or might have already been disposed.
UnityEngine.Rendering.Universal.ScriptableRenderer:get_cameraDepthTarget ()
HighlightPlus.HighlightPlusRenderPassFeature:AddRenderPasses (UnityEngine.Rendering.Universal.ScriptableRenderer,UnityEngine.Rendering.Universal.RenderingData&) (at Assets/Plugins/ART/HighlightPlus/Pipelines/URP/HighlightPlusRenderPassFeature.cs:73)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Does someone have any idea what can cause this and how to fix this?

1 Like

Bump

Without looking at the code producing the error It’s going to be really hard to help you resolve the error.
I’ve seen the same error while working on my code, and it might be the same thing causing yours.
I resolved mine by passing the ScriptableRenderer class, when URP calls AddRenderPasses, to the ScriptableRenderPass class.

You might get a better idea of what I did here: Writing to depth using Compute shader for Checkerboard Rendering

Truth be told, I feel like it’s a janky solution, but I haven’t been able to find someone from Unity giving us direction on what we should to do in this case, so

Turns out the asset that caused the issue wasn’t fully compatible with the URP yet. I commented out the line and it still worked fine :stuck_out_tongue: