MenuItem Not Appearing/Visible

I’m in the process of creating a quest manager, I wanted to create a custom window where a user could fill in text fields and then dynamically add in “task” objects so that you could make a quest where all you do is talk to 1 NPC, or a quest where you talk to 1 NPC, kill 5 NPCs, gather their Heads and hand into the original NPC.

I’ve an old project where I am creating a tile manager so I’ve created a custom window before, however I’m having just the most ridiculous time making it appear of all things!

Here’s my code:

using UnityEngine;
using UnityEditor;

public class QuestEditor : EditorWindow
{

    [MenuItem("Window/Quest Editor")]
    public static void CreateEditor()
    {
        EditorWindow.GetWindow<QuestEditor>("Quest Editor");
    }

    private void OnGUI()
    {
        //Do Quest Stuff
    }

}

And here’s my project setup / what I see when opening the Window option:

This is infuriating me to no end, all I can find online is to add an editor folder or add in the code I already have. This is the minimum amount of code I need to create this functionality, I’ve no idea what I’m missing, I feel it has to be either some tool change I don’t know or so infinitesimally small I may blow my brains out.

Who can help me on this ridiculous issue?

I have the same issue^ can’t figure out what changed

I have also the same issue. This worked in 5.6, but not in 2017.3…

Even if I move the scripts to Assets/Editor, no menu items show up.

EDIT:

When I added [ExecuteInEditMode] to one of my old editor scripts, they all showed up in the menu. So, a new Unity 2017.x bug?

not sure but you can try this:

try making sure the class name is the same as the file name or try putting your class under a namespace

Same in 2018.3.0f2, just doesn’t appear anymore. Indeed worked fine in 5.6

Any updates on this issue? I have the same problem and it has been dragging for months now.

same issue here, any updates on this,
seams like it is only working if the static item menu method is in an editor class instead of EditorWindow

Restarting the editor generally works or just doing some random things, but I would say that it is indeed a bug

1 Like

@jvo3dc i got it working by doing complete random things inside visual studio to force it to recompile, it is really crazy

i found a fix for this issue, it is not the best but it is better than trying silly things hoping that it will work
first in the menu item method reponsable for spawning your window try this

  [MenuItem("Tools/Services")]
    public static void Services()
    {
       var win= EditorWindow.GetWindow(typeof(ServicesWindow), true, "services Settings", true);
       DestroyImmediate(win);
    }

execute this once then transform your menu item method again to this

  [MenuItem("Tools/Services")]
    public static void Services()
    {
        EditorWindow.GetWindow(typeof(ServicesWindow), true, "services Settings", true);
    }

now your window will certainly open

1 Like