Skip to content

Commit 7b84523

Browse files
pmavridissebastienlagarde
authored andcommitted
Fixed null reference exception in LookDev when setting the SRP to None #447
1 parent 2f5ea1c commit 7b84523

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

com.unity.render-pipelines.core/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1414
- Fixed copy/pasting of Volume Components when loading a new scene
1515
- Fix LookDev's camera button layout.
1616
- Fix LookDev's layout vanishing on domain reload.
17+
- Fixed null reference exception in LookDev when setting the SRP to one not implementing LookDev (case 1245086)
1718

1819
## [7.3.0] - 2020-03-11
1920

com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using UnityEngine;
44
using UnityEngine.UIElements;
55

6+
using RenderPipelineManager = UnityEngine.Rendering.RenderPipelineManager;
7+
68
namespace UnityEditor.Rendering.LookDev
79
{
810
/// <summary>Interface that must implement the viewer to communicate with the compositor and data management</summary>
@@ -680,6 +682,17 @@ void OnGUI()
680682
rootVisualElement.styleSheets.Add(styleSheetLight);
681683
}
682684

685+
// [case 1245086] Guard in case the SRP asset is set to null (or to a not supported SRP) when the lookdev window is already open
686+
// Note: After an editor reload, we might get a null OnUpdateRequestedInternal and null SRP for a couple of frames, hence the check.
687+
if (!LookDev.supported && OnUpdateRequestedInternal !=null)
688+
{
689+
// Print an error and close the Lookdev window (to avoid spamming the console)
690+
Debug.LogError($"LookDev is not supported by this Scriptable Render Pipeline: "
691+
+ (RenderPipelineManager.currentPipeline == null ? "No SRP in use" : RenderPipelineManager.currentPipeline.ToString()));
692+
LookDev.Close();
693+
return;
694+
}
695+
683696
OnUpdateRequestedInternal?.Invoke();
684697
}
685698
}

0 commit comments

Comments
 (0)