File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -1475,8 +1475,10 @@ internal static void CleanUnused()
1475
1475
continue ;
1476
1476
1477
1477
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 ) )
1480
1482
s_Cleanup . Add ( key ) ;
1481
1483
}
1482
1484
You can’t perform that action at this time.
0 commit comments