I’m starting out with a simple UI addition to the editor, and for some reason, the window does not appear. No errors in Visual Studio, and no errors in the Unity Editor Console when I select the menu item.
I just followed the instructions here: Unity - Scripting API: EditorWindow.GetWindow
Here’s the code:
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
public class MenuCreateWorldTilemap : EditorWindow
{
//Add a menu entry that will bring up the World Tilemap creation window
[MenuItem("FiftyTifty/World/Create World Tilemap")]
static void menuCreateWorldTilemap()
{
EditorWindow windowCreateWorldTilemap = (MenuCreateWorldTilemap) EditorWindow.GetWindow(typeof(MenuCreateWorldTilemap), true, "Create World Tilemap", true);
windowCreateWorldTilemap.titleContent = new GUIContent("Create World Tilemap");
}
[MenuItem("FiftyTifty/World/Create World Tilemap", false)]
private static bool menuCreateWorldTilemap_Check()
{
return GameObject.Find("tilemapWorld");
}
}
This should just work, no? I’ve passed the proper arguments, the menu entry is not greyed out, and it is selectable. The window just won’t appear for some reason. Any idea why?