Copyright © 2026 Unity Technologies
The renderer can't know the two calls to Camera.Render are connected and allocates a different depth buffer. This is not the case with the main scene as the engine knows all the cameras before rendering and assigns them to the same stack. A possible workaround is as follows 1) Create new render texture asset in the project 2) Duplicate First & second cam and set them up in the inspector to render to the render texture from (1) 3) Assing the render texture from (1) to the RawImage canvas object Similar set-up can be achieved from script. Setting it up this way means unity will automatically set up the two cameras as part of a stack and render correctly to them every frame as part of the main update loop. This also doesn't need a script. I hope this helps.
Reproduction steps:
Expected result: The “Cube” and “Sphere” GameObjects will not overlap
Actual result: GameObjects "Cube" and "Sphere" overlap
Reproducible with: 2020.3.41f1, 2021.3.12f1, 2022.1.21f1, 2022.2.0b13, 2023.1.0a16
Reproducible on: Intel macOS 16
Note: The "Second (sphere) Camera" GameObject clears the depth buffer during off-screen rendering, causing the "Cube" and "Sphere" GameObjects to overlap.
Issues you vote on will appear here