Skip to content

Commit 5a94418

Browse files
EvgeniiGEvergreen
authored andcommitted
Fix UUM-43568 - Discrepancy between the Render Texture and the actual render when using the Camera
Fix https://jira.unity3d.com/browse/UUM-43568
1 parent 20c0523 commit 5a94418

File tree

1 file changed

+4
-2
lines changed
  • Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera

1 file changed

+4
-2
lines changed

Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,8 +1475,10 @@ internal static void CleanUnused()
14751475
continue;
14761476

14771477
bool hasPersistentHistory = camera.m_AdditionalCameraData != null && camera.m_AdditionalCameraData.hasPersistentHistory;
1478-
// We keep preview camera around as they are generally disabled/enabled every frame. They will be destroyed later when camera.camera is null
1479-
if (camera.camera == null || (!camera.camera.isActiveAndEnabled && camera.camera.cameraType != CameraType.Preview && !hasPersistentHistory && !camera.isPersistent))
1478+
// We keep preview camera around as they are generally disabled/enabled every frame. They will be destroyed later when camera.camera is null.
1479+
// We also cannot dispose of disabled Game View cameras. They can still be used for rendering from script via Camera.Render.
1480+
// If we dispose of a camera, we risk invalidating all cached data associated with it (e.g. the cached sky rendering context).
1481+
if (camera.camera == null || (!camera.camera.isActiveAndEnabled && camera.camera.cameraType != CameraType.Preview && camera.camera.cameraType != CameraType.Game && !hasPersistentHistory && !camera.isPersistent))
14801482
s_Cleanup.Add(key);
14811483
}
14821484

0 commit comments

Comments
 (0)