Search Unity

Bug URP 14.0.7 with stacked cameras and post processing disabled throws exception in update loop

Discussion in 'Universal Render Pipeline' started by spajus, Jun 4, 2023.

  1. spajus

    spajus

    Joined:
    Jun 10, 2015
    Posts:
    47
    I'm using multiple cameras and have post processing disabled / set to "update via scripting". I don't have any volumes either. Now when I load the first scene, everything works, VolumeManager.instance.stack contains 17 post processing effects that are all disabled.

    When the scene changes however, the second scene tries to get VolumeManager.instance.stack again (for each camera) when it checks if depth texture is required. At that moment the stack is blank, and the method that tries to get DepthOfField effect parameters gets a null and tries to invoke a property on it.

    In addition to fixing this bug, if post processing is disabled, it would be nice to not even try to query the volume stack for particular effect settings at all every single frame for every single camera, as it seems wasteful.

    Switching Post Processing from "Via Scripting" to "Every Frame" in URP settings fixes the issue.

    But here is the cost of "Every Frame" vs "Via Scripting" with zero active post processing effects:
    The dip in the midile is switched to Via Scripting, start and end of the capture is with "Every Frame":



    A bug report that includes a repro project: IN-42943
     
    Last edited: Jun 4, 2023