Skip to content

Commit 1d8d6c5

Browse files
Fixed an issue when trying to open a look dev env library when Look Dev is not supported. (#2929)
* Fixed an issue when trying to open a look dev env library when Look Dev is not supported. * Update changelog Co-authored-by: sebastienlagarde <[email protected]>
1 parent 4befd38 commit 1d8d6c5

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Collections.Generic;
55
using UnityEngine.UIElements;
66
using System.IO;
7+
using UnityEditor;
78
using UnityEditor.UIElements;
89

910
namespace UnityEditor.Rendering.LookDev
@@ -117,26 +118,38 @@ public int IndexOf(Environment environment)
117118
[CustomEditor(typeof(EnvironmentLibrary))]
118119
class EnvironmentLibraryEditor : Editor
119120
{
120-
VisualElement root;
121+
VisualElement m_Root;
122+
VisualElement m_OpenButton;
121123

122124
public sealed override VisualElement CreateInspectorGUI()
123125
{
124126
var library = target as EnvironmentLibrary;
125-
root = new VisualElement();
127+
m_Root = new VisualElement();
126128

127-
Button open = new Button(() =>
129+
m_OpenButton = new Button(() =>
128130
{
129131
if (!LookDev.open)
130132
LookDev.Open();
131133
LookDev.currentContext.UpdateEnvironmentLibrary(library);
132134
LookDev.currentEnvironmentDisplayer.Repaint();
133135
})
134136
{
135-
text = "Open in LookDev window"
137+
text = "Open in Look Dev window"
136138
};
139+
m_OpenButton.SetEnabled(LookDev.supported);
137140

138-
root.Add(open);
139-
return root;
141+
m_Root.Add(m_OpenButton);
142+
return m_Root;
143+
}
144+
145+
void OnEnable() => EditorApplication.update += Update;
146+
void OnDisable() => EditorApplication.update -= Update;
147+
148+
void Update()
149+
{
150+
// Current SRP can be changed at any time so we need to do this at every update.
151+
if (m_OpenButton != null)
152+
m_OpenButton.SetEnabled(LookDev.supported);
140153
}
141154

142155
// Don't use ImGUI

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
3838
- Fixed ShaderGraph stack blocks appearing when opening the settings in Hair and Eye ShaderGraphs.
3939
- Fixed white screen when undoing in the editor.
4040
- Fixed display of LOD Bias and maximum level in frame settings when using Quality Levels
41+
- Fixed an issue when trying to open a look dev env library when Look Dev is not supported.
4142

4243
### Changed
4344
- Removed the material pass probe volumes evaluation mode.

0 commit comments

Comments
 (0)