Let’s now create your Editor window and add it to Unity’s menu bar:
public class QuickTool : EditorWindow
{
[MenuItem("QuickTool/Open _%#T")]
public static void ShowWindow()
{
// Opens the window, otherwise focuses it if it’s already open.
var window = GetWindow<QuickTool>();
// Adds a title to the window.
window.titleContent = new GUIContent("QuickTool");
// Sets a minimum size to the window.
window.minSize = new Vector2(250, 50);
}
}
Note: The characters _%#T at the end of the MenuItem string lets us add a shortcut to open the window, which is here CTRL + SHIFT + T.Save your code and go back to Unity. You should see a new item called “QuickTool” in the menu bar: click on it. Then, if you click on “Open”, your window should open (and be empty). Note: Verify that the title of your window is correct (in this case, “QuickTool”).