diff --git a/src/Inspectors/MouseInspectors/UiInspector.cs b/src/Inspectors/MouseInspectors/UiInspector.cs index e4965ee..305add2 100644 --- a/src/Inspectors/MouseInspectors/UiInspector.cs +++ b/src/Inspectors/MouseInspectors/UiInspector.cs @@ -39,7 +39,7 @@ namespace UnityExplorer.Inspectors.MouseInspectors LastHitObjects.Clear(); LastHitObjects.AddRange(currentHitObjects); var panel = UIManager.GetPanel(UIManager.Panels.UIInspectorResults); - UIManager.SetPanelActive(panel, true); + panel.SetActive(true); panel.ShowResults(); } diff --git a/src/UI/Panels/UIPanel.cs b/src/UI/Panels/UIPanel.cs index 6aadd51..3f71576 100644 --- a/src/UI/Panels/UIPanel.cs +++ b/src/UI/Panels/UIPanel.cs @@ -124,6 +124,11 @@ namespace UnityExplorer.UI.Panels if (!active) this.Dragger.WasDragging = false; + else + { + this.UIRoot.transform.SetAsLastSibling(); + InvokeOnPanelsReordered(); + } } public override void Destroy() diff --git a/src/UI/UIManager.cs b/src/UI/UIManager.cs index 7081d12..320186e 100644 --- a/src/UI/UIManager.cs +++ b/src/UI/UIManager.cs @@ -184,26 +184,21 @@ namespace UnityExplorer.UI SetPanelActive(panel, !uiPanel.Enabled); } - public static void SetPanelActive(Panels panel, bool active) + public static void SetPanelActive(Panels panelType, bool active) { - var obj = GetPanel(panel); - SetPanelActive(obj, active); + GetPanel(panelType) + .SetActive(active); } public static void SetPanelActive(UIPanel panel, bool active) { panel.SetActive(active); - if (active) - { - panel.UIRoot.transform.SetAsLastSibling(); - UIPanel.InvokeOnPanelsReordered(); - } } internal static void SetPanelActive(Transform transform, bool value) { if (UIPanel.transformToPanelDict.TryGetValue(transform.GetInstanceID(), out UIPanel panel)) - SetPanelActive(panel, value); + panel.SetActive(value); } // navbar