Search Unity

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

Discussion in 'Universal Render Pipeline' started by DevDunk, Sep 13, 2021.

  1. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,043
    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
    Code (CSharp):
    1. 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.
    2. UnityEngine.Rendering.Universal.ScriptableRenderer:get_cameraDepthTarget ()
    3. HighlightPlus.HighlightPlusRenderPassFeature:AddRenderPasses (UnityEngine.Rendering.Universal.ScriptableRenderer,UnityEngine.Rendering.Universal.RenderingData&) (at Assets/Plugins/ART/HighlightPlus/Pipelines/URP/HighlightPlusRenderPassFeature.cs:73)
    4. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    Does someone have any idea what can cause this and how to fix this?
     
    SolidAlloy likes this.
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,043
  3. j_chai

    j_chai

    Joined:
    Jun 30, 2021
    Posts:
    38
    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: https://forum.unity.com/threads/wri...te-shader-for-checkerboard-rendering.1180165/

    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
     
  4. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,043
    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 :p