From b1263883a9a5cdf1bff58a194d76b085861414e1 Mon Sep 17 00:00:00 2001 From: r Star Date: Fri, 13 Jan 2023 22:40:23 +0800 Subject: [PATCH] close if open --- .../Editor/BookmarkEverythingEditor.cs | 13 ++++++++----- .../UserSettings/EditorUserSettings.asset | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/BookmarkEverything/Assets/BookmarkEverything/Editor/BookmarkEverythingEditor.cs b/BookmarkEverything/Assets/BookmarkEverything/Editor/BookmarkEverythingEditor.cs index 4e7496f..e7a09cc 100644 --- a/BookmarkEverything/Assets/BookmarkEverything/Editor/BookmarkEverythingEditor.cs +++ b/BookmarkEverything/Assets/BookmarkEverything/Editor/BookmarkEverythingEditor.cs @@ -946,15 +946,18 @@ private string GetNameOfCategory(int index) [MenuItem("Window/Bookmark Everything %h")] private static void Init() { - var windows = (BookmarkEverythingEditor[])Resources.FindObjectsOfTypeAll(typeof(BookmarkEverythingEditor)); - if (windows.Length == 0) + var hasOpenInstances = HasOpenInstances(); + var window = GetWindow(); + // var windows = (BookmarkEverythingEditor[])Resources.FindObjectsOfTypeAll(typeof(BookmarkEverythingEditor)); + if (hasOpenInstances) { - BookmarkEverythingEditor window = (BookmarkEverythingEditor)GetWindow(typeof(BookmarkEverythingEditor)); - window.InitInternal(); + // FocusWindowIfItsOpen(typeof(BookmarkEverythingEditor)); + window.Close(); } else { - FocusWindowIfItsOpen(typeof(BookmarkEverythingEditor)); + // BookmarkEverythingEditor window = (BookmarkEverythingEditor)GetWindow(typeof(BookmarkEverythingEditor)); + window.InitInternal(); } } diff --git a/BookmarkEverything/UserSettings/EditorUserSettings.asset b/BookmarkEverything/UserSettings/EditorUserSettings.asset index e609a3a..31e0f59 100644 --- a/BookmarkEverything/UserSettings/EditorUserSettings.asset +++ b/BookmarkEverything/UserSettings/EditorUserSettings.asset @@ -6,10 +6,10 @@ EditorUserSettings: serializedVersion: 4 m_ConfigSettings: RecentlyUsedSceneGuid-0: - value: 5507520757065b0f590d092612260f44124f1c2e7c7d7e342f2c4b60b4b4323d + value: 515250075c0c595e5f5a5e71122159444e4e4a2f7a7d7f602f284d66b4b76661 flags: 0 RecentlyUsedSceneGuid-1: - value: 515250075c0c595e5f5a5e71122159444e4e4a2f7a7d7f602f284d66b4b76661 + value: 5507520757065b0f590d092612260f44124f1c2e7c7d7e342f2c4b60b4b4323d flags: 0 vcSharedLogLevel: value: 0d5e400f0650