Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error when loading new scene #2713

Merged
merged 3 commits into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixes some labels being clipped in the Render Graph Viewer
- Fixed issue when decal projector material is none.
- Fixed the sampling of the normal buffer in the the forward transparent pass.
- Fixed NullReferenceException when loading multipel scene async

## [10.2.0] - 2020-10-19

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