diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index f289ff230cf..12bc60e991a 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -737,6 +737,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Remove MSAA debug mode when renderpipeline asset has no MSAA - Fixed some post processing using motion vectors when they are disabled - Fixed the multiplier of the environement lights being overriden with a wrong value for ray tracing (1260311). +- Fixed a series of exceptions happening when trying to load an asset during wizard execution (1262171). ### Changed - Improve MIP selection for decals on Transparents diff --git a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs index 67236777add..9d8c5069350 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.Configuration.cs @@ -217,9 +217,14 @@ class QueuedLauncher Queue m_Queue = new Queue(); bool m_Running = false; bool m_StopRequested = false; + bool m_OnPause = false; public void Stop() => m_StopRequested = true; + // Function to pause/unpause the action execution + public void Pause() => m_OnPause = true; + public void Unpause() => m_OnPause = false; + public int remainingFixes => m_Queue.Count; void Start() @@ -242,7 +247,12 @@ void Run() m_StopRequested = false; } if (m_Queue.Count > 0) - m_Queue.Dequeue()?.Invoke(); + { + if (!m_OnPause) + { + m_Queue.Dequeue()?.Invoke(); + } + } else End(); } diff --git a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.UIElement.cs b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.UIElement.cs index a03dbcd092c..6b369a51d66 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.UIElement.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Wizard/HDWizard.UIElement.cs @@ -32,6 +32,9 @@ static class ObjectSelector public static bool opened => Resources.FindObjectsOfTypeAll(typeof(PlayerSettings).Assembly.GetType("UnityEditor.ObjectSelector")).Length > 0; + // Action to be called with the window is closed + static Action s_OnClose; + static ObjectSelector() { Type playerSettingsType = typeof(PlayerSettings); @@ -73,12 +76,22 @@ static ObjectSelector() GetCurrentObject = getCurrentObjectLambda.Compile(); } - public static void Show(UnityEngine.Object obj, Type type, Action onChangedObject) + public static void Show(UnityEngine.Object obj, Type type, Action onChangedObject, Action onClose) { id = GUIUtility.GetControlID("s_ObjectFieldHash".GetHashCode(), FocusType.Keyboard); GUIUtility.keyboardControl = id; ShowObjectSelector(obj, type, onChangedObject); selectorID = id; + ObjectSelector.s_OnClose = onClose; + EditorApplication.update += CheckClose; + } + static void CheckClose() + { + if (!opened) + { + ObjectSelector.s_OnClose?.Invoke(); + EditorApplication.update -= CheckClose; + } } public static void CheckAssignationEvent(Action assignator) @@ -132,8 +145,12 @@ void CreateOrLoad(Action onCancel, Action onObjectChanged) onCancel?.Invoke(); break; case 2: //Load - ObjectSelector.Show(target, typeof(T), o => onObjectChanged?.Invoke((T)o)); - break; + { + m_Fixer.Pause(); + ObjectSelector.Show(target, typeof(T), o => onObjectChanged?.Invoke((T)o), m_Fixer.Unpause); + break; + } + default: throw new ArgumentException("Unrecognized option"); }