Search code examples
unity-game-engineoptimizationcamerarenderculling

Does setting camera's culling mask to Nothing when UI covers the screen is good?


I have a pretty large and full scene and therefore gets a lot of draw calls.

Sometimes I display a video in the game, which covers the entire screen. When I tested my game with Unity's profiler tool I noticed that the camera still renders everything (although occlusion culling is enabled and calculated), and it causes the video to lag.

My question is how can I disable the camera?

When I disable the Camera component or the camera's GameObject I get a warning ⚠ in the game view that says No camera is rendering to this display. Which, I guess, is not good (correct me if I'm wrong).

So I was wondering if cancelling the culling mask on the camera (by setting it to Nothing) would force unity to stop render the scene. Or does it still do some work in the background? (Like with UI elements that still being rendered even though they are fully transparent).

Thanks in advance


Solution

  • I have a pretty large and full scene and therefore gets a lot of draw calls.

    I recommend activating "Instancing" on your materials, it can greatly reduce draw calls.

    When the UI Pops open, it can help removing the "Default" layer (or whatever layer the majority of your renderers are) from the active cameras. You can do this easily with layer masks. Or you can just set Camera.main.farClippingPlane to 1 or any low number.