Skip to content

Instantly share code, notes, and snippets.

@SiarheiPilat
Created April 30, 2022 05:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SiarheiPilat/d2e1ff0cde00f5d7393a3f6a046007b6 to your computer and use it in GitHub Desktop.
Save SiarheiPilat/d2e1ff0cde00f5d7393a3f6a046007b6 to your computer and use it in GitHub Desktop.
// taken from https://forum.unity.com/threads/shortcut-to-close-editor-window-close-tab.1232121/
using UnityEditor;
using UnityEngine;
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