Search code examples
unity-game-enginegame-enginegame-developmentunity3d-editor

Can't find "clear flags" option in the camera's inspector


I have two unity projects open and I just noticed that the inspector for the camera object is different between the two. The Picture below shows inspector of both projects. I am used to the inspector on the left from tutorials. Is there a reason why the inspector on other project looks different ?

I want to change "clear flag" to depth only but I am not finding this option in the inspector of the other project (also under "Background Type" there is no depth only option). Is there another way to get the same effect as depth only on the second inspector?

enter image description here


Solution

  • The reason why the flag is missing in the second image is because that project is using the Universal Render Pipeline (URP) instead of the Built-in Render Pipeline.

    Based on the Camera documentation, Background Type contains the functionality now, with the options:

    • Skybox
    • Solid Color
    • Uninitialized

    enter image description here

    You'll note that "Depth only" isn't an option here. According to the FAQs for the URP, the following reason was given for why this is the case:

    We’ve deprecated camera clear flags in LWRP. Instead, you can set the Background Type in the Camera Inspector. We’ve done this because the clear flags Depth Only and Don’t Care from the Built-in render pipeline has inherent performance pitfalls. The clear flags were used for camera stacking, where one camera depends on the results of a previous camera. This is bad for performance, as it executes culling multiple times and increases bandwidth. Bandwidth cost is especially important for mobile games.

    For these reasons, we're working on a solution where you can add a render pass with custom camera matrices and FOV. This way, we can provide an optimized workflow instead of creating a Camera object. We plan to expose this custom render pass in a future LWRP package.

    From the sounds of it, this functionality can't be readily reproduced in the URP, though they're working on a future solution to make it possible again.