From 2590dd6823c4763fa1ef8dace38909991735b8e5 Mon Sep 17 00:00:00 2001 From: Julien Ignace Date: Wed, 24 Jun 2020 15:15:25 +0200 Subject: [PATCH 1/2] Fixed an issue where opening the look dev window with the light theme would make the window blink and eventually crash unity. --- .../Editor/LookDev/DisplayWindow.cs | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs b/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs index 12b7368fccc..01d4c7c00e2 100644 --- a/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs +++ b/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs @@ -42,7 +42,7 @@ public interface IViewDisplayer /// Callback on update requested event Action OnUpdateRequested; } - + partial class DisplayWindow : EditorWindow, IViewDisplayer { static partial class Style @@ -82,7 +82,7 @@ internal static readonly (Texture2D icon, string tooltip) k_LayoutStackIcon = internal const string k_CameraMenuSync1On2 = "Align Camera 1 with Camera 2"; internal const string k_CameraMenuSync2On1 = "Align Camera 2 with Camera 1"; internal const string k_CameraMenuReset = "Reset Cameras"; - + internal const string k_EnvironmentSidePanelName = "Environment"; internal const string k_DebugSidePanelName = "Debug"; @@ -127,7 +127,7 @@ internal static readonly (Texture2D icon, string tooltip) k_LayoutStackIcon = Label m_NoEnvironment2; Image[] m_Views = new Image[2]; - + LayoutContext layout => LookDev.currentContext.layout; @@ -143,7 +143,7 @@ Layout viewLayout } } } - + SidePanel sidePanel { get => layout.showedSidePanel; @@ -218,7 +218,7 @@ event Action IViewDisplayer.OnUpdateRequested void OnEnable() { - //Stylesheet + //Stylesheet // Try to load stylesheet. Timing can be odd while upgrading packages (case 1219692). // In this case, it will be fixed in OnGUI. Though it can spawn error while reimporting assets. // Waiting for filter on stylesheet (case 1228706) to remove last error. @@ -486,7 +486,7 @@ Rect IViewDisplayer.GetRect(ViewCompositionIndex index) throw new ArgumentException("Unknown ViewCompositionIndex: " + index); } } - + Vector2 m_LastFirstViewSize = new Vector2(); Vector2 m_LastSecondViewSize = new Vector2(); void IViewDisplayer.SetTexture(ViewCompositionIndex index, Texture texture) @@ -532,7 +532,7 @@ void IViewDisplayer.SetTexture(ViewCompositionIndex index, Texture texture) throw new ArgumentException("Unknown ViewCompositionIndex: " + index); } } - + void IViewDisplayer.Repaint() => Repaint(); void ApplyLayout(Layout value) @@ -627,19 +627,21 @@ IStyle GetEnvironmentContenairDraggerStyle() void OnGUI() { - //Stylesheet + //Stylesheet // [case 1219692] if LookDev is open while reimporting CoreRP package, // stylesheet can be null. In this case, we can have a null stylesheet - // registered as it got destroyed. Reloading it. As we cannot just + // registered as it got destroyed. Reloading it. As we cannot just // remove a null entry, we must filter and reconstruct the while list. if (styleSheet == null || styleSheet.Equals(null) || (!EditorGUIUtility.isProSkin && (styleSheetLight == null || styleSheetLight.Equals(null)))) { // While (case 1228706) is still on going, we sill close and reopen the look dev. // This will prevent spawning error at frame. - LookDev.Close(); - LookDev.Open(); - return; + // Note 2: This actually causes the lookdev to break completely with light theme. + // Until the actual issue is fixed, we'll comment this fix out as it only concerns an upgrade problem. + //LookDev.Close(); + //LookDev.Open(); + //return; // Following lines is the correct fix if UIElement filter garbage collected Stylesheet. @@ -689,7 +691,7 @@ void OnGUI() } // [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 - // Note: After an editor reload, we might get a null OnUpdateRequestedInternal and null SRP for a couple of frames, hence the check. + // Note: After an editor reload, we might get a null OnUpdateRequestedInternal and null SRP for a couple of frames, hence the check. if (!LookDev.supported && OnUpdateRequestedInternal !=null) { // Print an error and close the Lookdev window (to avoid spamming the console) From e95dcafb371ebb48f8e7e069fece18987cea029d Mon Sep 17 00:00:00 2001 From: Julien Ignace Date: Thu, 2 Jul 2020 10:55:47 +0200 Subject: [PATCH 2/2] Update changelog --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 4c479b530fb..22929a1b003 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -95,6 +95,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed an issue where static sky lighting would not be updated for a new scene until it's reloaded at least once. - Fixed missing include guards in shadow hlsl files. - Fixed issue with light layers bigger than 8 (and above the supported range). +- Fixed an issue where opening the look dev window with the light theme would make the window blink and eventually crash unity. ### Changed - Rejecting history for ray traced reflections based on a threshold evaluated on the neighborhood of the sampled history.