Last active
November 17, 2022 05:33
-
-
Save q8f13/31ecf8789c637a1d1922db8289594be6 to your computer and use it in GitHub Desktop.
add close current tab to unity editor. Use with shortcut manager. Use with editor shortcut setup. For example "ctrl+w to close current active panel"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
public class EditorCloseWindowTab : Editor | |
{ | |
[MenuItem("Shortcuts/Close Window Tab")] | |
static void CloseTab() | |
{ | |
EditorWindow focusedWindow = EditorWindow.focusedWindow; | |
if (focusedWindow != null) | |
{ | |
CloseTab(focusedWindow); | |
} | |
else | |
{ | |
Debug.LogWarning("Found no focused window to close"); | |
} | |
} | |
static void CloseTab(EditorWindow editorWindow) | |
{ | |
editorWindow.Close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment