diff --git a/Source/Editor/Windows/Assets/ModelBaseWindow.cs b/Source/Editor/Windows/Assets/ModelBaseWindow.cs index 3046ea43b..89ff1ff96 100644 --- a/Source/Editor/Windows/Assets/ModelBaseWindow.cs +++ b/Source/Editor/Windows/Assets/ModelBaseWindow.cs @@ -117,9 +117,12 @@ namespace FlaxEditor.Windows.Assets public override void OnClean() { - Window._isolateIndex = -1; - Window._highlightIndex = -1; - Window._meshProxy = null; + if (Window != null) + { + Window._isolateIndex = -1; + Window._highlightIndex = -1; + Window._meshProxy = null; + } base.OnClean(); } diff --git a/Source/Engine/UI/GUI/ContainerControl.cs b/Source/Engine/UI/GUI/ContainerControl.cs index aa0078c19..0caca6509 100644 --- a/Source/Engine/UI/GUI/ContainerControl.cs +++ b/Source/Engine/UI/GUI/ContainerControl.cs @@ -171,6 +171,12 @@ namespace FlaxEngine.GUI /// public virtual void DisposeChildren() { + // Steal focus from children to maintain it in a hierarchy + if (ContainsFocus) + { + Focus(); + } + bool wasLayoutLocked = _isLayoutLocked; _isLayoutLocked = true;