diff --git a/com.unity.render-pipelines.core/Editor/LookDev/EnvironmentLibrary.cs b/com.unity.render-pipelines.core/Editor/LookDev/EnvironmentLibrary.cs index 03edd2af2c1..3e84f031b20 100644 --- a/com.unity.render-pipelines.core/Editor/LookDev/EnvironmentLibrary.cs +++ b/com.unity.render-pipelines.core/Editor/LookDev/EnvironmentLibrary.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using UnityEngine.UIElements; using System.IO; +using UnityEditor; using UnityEditor.UIElements; namespace UnityEditor.Rendering.LookDev @@ -117,14 +118,15 @@ public int IndexOf(Environment environment) [CustomEditor(typeof(EnvironmentLibrary))] class EnvironmentLibraryEditor : Editor { - VisualElement root; + VisualElement m_Root; + VisualElement m_OpenButton; public sealed override VisualElement CreateInspectorGUI() { var library = target as EnvironmentLibrary; - root = new VisualElement(); + m_Root = new VisualElement(); - Button open = new Button(() => + m_OpenButton = new Button(() => { if (!LookDev.open) LookDev.Open(); @@ -132,11 +134,22 @@ public sealed override VisualElement CreateInspectorGUI() LookDev.currentEnvironmentDisplayer.Repaint(); }) { - text = "Open in LookDev window" + text = "Open in Look Dev window" }; + m_OpenButton.SetEnabled(LookDev.supported); - root.Add(open); - return root; + m_Root.Add(m_OpenButton); + return m_Root; + } + + void OnEnable() => EditorApplication.update += Update; + void OnDisable() => EditorApplication.update -= Update; + + void Update() + { + // Current SRP can be changed at any time so we need to do this at every update. + if (m_OpenButton != null) + m_OpenButton.SetEnabled(LookDev.supported); } // Don't use ImGUI diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index f2a97c53623..2818006b9b8 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -38,6 +38,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed ShaderGraph stack blocks appearing when opening the settings in Hair and Eye ShaderGraphs. - Fixed white screen when undoing in the editor. - Fixed display of LOD Bias and maximum level in frame settings when using Quality Levels +- Fixed an issue when trying to open a look dev env library when Look Dev is not supported. ### Changed - Removed the material pass probe volumes evaluation mode.