From bf77031ada4e8baf044e4ba28b4cef12c8c011de Mon Sep 17 00:00:00 2001 From: AlexanderVorobyov Date: Sun, 3 Oct 2021 20:39:32 +0300 Subject: [PATCH] Update DebugUIWindowDrawer.cs --- .../Runtime/DebugUIWindowDrawer.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Packages/UGF.DebugTools/Runtime/DebugUIWindowDrawer.cs b/Packages/UGF.DebugTools/Runtime/DebugUIWindowDrawer.cs index d10fba9..2d3473f 100644 --- a/Packages/UGF.DebugTools/Runtime/DebugUIWindowDrawer.cs +++ b/Packages/UGF.DebugTools/Runtime/DebugUIWindowDrawer.cs @@ -1,5 +1,5 @@ using System; -using UnityEditor; +using UGF.DebugTools.Runtime.UI.Scopes; using UnityEngine; namespace UGF.DebugTools.Runtime @@ -21,6 +21,13 @@ protected DebugUIWindowDrawer() m_windowFunction = OnWindow; } + protected override void OnInitialize() + { + base.OnInitialize(); + + m_windowId = GetHashCode(); + } + public void Focus() { if (m_windowId.HasValue) @@ -40,13 +47,11 @@ protected override void OnDrawGUI() { OnUpdatePosition(); - m_windowId ??= GetHashCode(); - GUIStyle style = DisplayBackground ? GUI.skin.window : GUIStyle.none; Position = IsModal - ? GUI.ModalWindow(m_windowId.Value, Position, m_windowFunction, GUIContent.none, style) - : GUI.Window(m_windowId.Value, Position, m_windowFunction, GUIContent.none, style); + ? GUI.ModalWindow(WindowId, Position, m_windowFunction, GUIContent.none, style) + : GUI.Window(WindowId, Position, m_windowFunction, GUIContent.none, style); } } @@ -58,11 +63,11 @@ protected virtual void OnUpdatePosition() private void OnWindow(int id) { - using (var view = new EditorGUILayout.ScrollViewScope(m_scroll)) + using (var view = new DebugUIScrollViewScope(m_scroll)) { OnDrawGUILayout(); - m_scroll = view.scrollPosition; + m_scroll = view.ScrollPosition; } } }