

You enable effects like Depth of Field, Screen Space Shadows, or custom shaders that rely on depth textures. Everything looks fine in the Scene view, but in the Game view or the final build, shadows or post-processing effects appear missing or broken.
This is often referred to as the “Camera Depth Texture bug.” In reality, this usually occurs because the camera’s settings for depth textures are not configured correctly or because certain rendering pipelines require explicit activation.
Depth textures store the distance from the camera to the closest object per pixel. Many effects use this information to create realistic visuals:
If the camera does not generate a depth texture, these effects cannot work properly.
Select your camera and check:
Enable:
By default, depth textures are not generated for performance reasons.
Different pipelines handle depth textures differently:
Failing to enable these settings is the most common cause of missing shadows or effects.
If the camera’s Clear Flags or Culling Mask exclude certain objects, the depth texture may not capture them.
Some effects fail if HDR is disabled or MSAA is enabled:
Custom shaders may rely on camera depth texture input. If the shader uses _CameraDepthTexture or sampler2D_float, the depth texture must be generated correctly by the pipeline.
Check your shader’s documentation and ensure the proper keyword or feature is enabled:
Shader.EnableKeyword("_CAMERA_DEPTH_TEXTURE");
If using the Post-Processing Stack:
Some effects render correctly in the Editor but fail in the build due to platform differences. Always test on target hardware.
Usually not. Missing shadows or depth-based effects are almost always caused by missing camera depth texture generation or incorrect pipeline settings.
Unity leaves depth textures off by default for performance reasons. Developers must enable them when needed.
Depth texture issues are predictable once you understand how Unity pipelines handle depth. By enabling depth textures, verifying pipeline settings, and checking camera configurations, shadows and depth-based effects will render consistently in both Editor and build.
Once configured correctly, your post-processing and depth-dependent effects will work reliably across all scenes and devices.