Skip to content

Commit

Permalink
fix: NRE from SetupRenderingMonitoring on scene change (#347)
Browse files Browse the repository at this point in the history
Reported-In: #345
  • Loading branch information
bdunderscore authored Aug 22, 2024
1 parent 898b5b4 commit d5e7657
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

### Fixed

- [#343] [#346] TargetSet is not invalidated when GetTargetGroups context is invalidated
- [#347] NullReferenceException from SetupRenderingMonitoring on scene change

### Changed

Expand Down
6 changes: 6 additions & 0 deletions Editor/PreviewSystem/Rendering/ProxyObjectController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ public ProxyObjectController(ProxyObjectCache cache, Renderer originalRenderer,

private void SetupRendererMonitoring(Renderer r)
{
if (r == null)
{
OnInvalidate = Task.CompletedTask;
return;
}

var gameObjectName = r.gameObject.name;
_monitorRenderer = new ComputeContext("Renderer Monitor for " + gameObjectName);
_monitorMaterials = new ComputeContext("Material Monitor for " + gameObjectName);
Expand Down

0 comments on commit d5e7657

Please sign in to comment.