Skip to content

Instantly share code, notes, and snippets.

@q8f13
Last active November 17, 2022 05:33
Show Gist options
  • Save q8f13/31ecf8789c637a1d1922db8289594be6 to your computer and use it in GitHub Desktop.
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"
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