From d05c118a83cc3a9283c61405f695b1864903ed1c Mon Sep 17 00:00:00 2001 From: Bryan McConkey Date: Tue, 12 Dec 2023 10:38:21 -0500 Subject: [PATCH] Handle root visual element being detached from m_currentToolbar when changing between displays of different DPI --- Editor/ToolbarCallback.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Editor/ToolbarCallback.cs b/Editor/ToolbarCallback.cs index 22e90cb..4a665e5 100644 --- a/Editor/ToolbarCallback.cs +++ b/Editor/ToolbarCallback.cs @@ -77,6 +77,9 @@ void RegisterCallback(string root, Action cb) { parent.Add(container); toolbarZone.Add(parent); } + + // Handle root visual element being detached from m_currentToolbar when changing between displays of different DPI + mRoot.RegisterCallback(_ => m_currentToolbar = null); #else #if UNITY_2020_1_OR_NEWER var windowBackend = m_windowBackend.GetValue(m_currentToolbar);