diff --git a/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs b/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs index 20a4a5ad363..9b831a25c67 100644 --- a/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs +++ b/com.unity.render-pipelines.core/Editor/LookDev/DisplayWindow.cs @@ -216,24 +216,48 @@ event Action IViewDisplayer.OnUpdateRequested StyleSheet styleSheet = null; StyleSheet styleSheetLight = null; - void OnEnable() + void ReloadStyleSheets() { - //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. - if (styleSheet == null || styleSheet.Equals(null)) + if(styleSheet == null || styleSheet.Equals(null)) { styleSheet = AssetDatabase.LoadAssetAtPath(Style.k_uss); - if (styleSheet != null && !styleSheet.Equals(null)) - rootVisualElement.styleSheets.Add(styleSheet); + if(styleSheet == null || styleSheet.Equals(null)) + { + //Debug.LogWarning("[LookDev] Could not load Stylesheet."); + return; + } } - if (!EditorGUIUtility.isProSkin && styleSheetLight != null && !styleSheetLight.Equals(null)) + + if(!rootVisualElement.styleSheets.Contains(styleSheet)) + rootVisualElement.styleSheets.Add(styleSheet); + + //Additively load Light Skin + if(!EditorGUIUtility.isProSkin) { - styleSheetLight = AssetDatabase.LoadAssetAtPath(Style.k_uss_personal_overload); - if (styleSheetLight != null && !styleSheetLight.Equals(null)) + if(styleSheetLight == null || styleSheetLight.Equals(null)) + { + styleSheetLight = AssetDatabase.LoadAssetAtPath(Style.k_uss_personal_overload); + if(styleSheetLight == null || styleSheetLight.Equals(null)) + { + //Debug.LogWarning("[LookDev] Could not load Light skin."); + return; + } + } + + if(!rootVisualElement.styleSheets.Contains(styleSheetLight)) rootVisualElement.styleSheets.Add(styleSheetLight); } + } + + void OnEnable() + { + //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. + // On Editor Skin change, OnEnable is called and stylesheets need to be reloaded (case 1278802). + if(EditorApplication.isUpdating) + ReloadStyleSheets(); //Call the open function to configure LookDev // in case the window where open when last editor session finished. @@ -694,14 +718,11 @@ void OnGUI() // rootVisualElement.styleSheets.Add(styleSheetLight); //} } - else - { - //deal with missing style when domain reload... - if (!rootVisualElement.styleSheets.Contains(styleSheet)) - rootVisualElement.styleSheets.Add(styleSheet); - if (!EditorGUIUtility.isProSkin && !rootVisualElement.styleSheets.Contains(styleSheetLight)) - rootVisualElement.styleSheets.Add(styleSheetLight); - } + if(EditorApplication.isUpdating) + return; + + //deal with missing style on domain reload... + ReloadStyleSheets(); OnUpdateRequestedInternal?.Invoke(); } diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 76b725033f9..a7860990fc4 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -1,4 +1,4 @@ -# Changelog +# Changelog All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) @@ -119,6 +119,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed rendergraph motion vector resolve. - Fixed the Ray-Tracing related Debug Display not working in render graph mode. - Fix nan in pbr sky +- Fixed Light skin not properly applied on the LookDev when switching from Dark Skin (case 1278802) ### Changed - Preparation pass for RTSSShadows to be supported by render graph.