Skip to content

Commit

Permalink
Fix error when loading new scene #2713
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienlagarde committed Nov 23, 2020
1 parent 44bd7fe commit ee02a53
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed issues that lead to cookie atlas to be updated every frame even if cached data was valid.
- Fixed an issue with opaque material using a shader graph with Transparent SurfaceType selected. FPTL was not working for this case.
- Fixed NaNs happening when upscaling ray tracing reflections in performance mode (case 1294076).
- Fixed NullReferenceException when loading multipel scene async

### Changed
- Remove MSAA debug mode when renderpipeline asset has no MSAA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,16 @@ public void ClearCamerasUnusedFor(int frameWindow, int frameCount)
m_Cache.Keys.CopyTo(cameraKeysCache, 0);
foreach (var key in cameraKeysCache)
{
m_Cache.TryGetValue(key, out var value);
if ((frameCount - value.lastFrame) > frameWindow)
if (m_Cache.TryGetValue(key, out var value))
{
CoreUtils.Destroy(value.camera.gameObject);
m_Cache.Remove(key);
if ((frameCount - value.lastFrame) > frameWindow)
{
if (value.camera != null)
{
CoreUtils.Destroy(value.camera.gameObject);
}
m_Cache.Remove(key);
}
}
}
}
Expand All @@ -79,7 +84,10 @@ public void Clear()
throw new ObjectDisposedException(nameof(CameraCache<K>));

foreach (var pair in m_Cache)
CoreUtils.Destroy(pair.Value.camera.gameObject);
{
if (pair.Value.camera != null)
CoreUtils.Destroy(pair.Value.camera.gameObject);
}
m_Cache.Clear();
}

Expand Down

0 comments on commit ee02a53

Please sign in to comment.