Add a custom menu item to a specific position (priority)

I wish to add a custom menu item and position it, i.e., to an editor menu and before a specific item.

For example if I have the following code:

[MenuItem(“File/Item1”, false, 1)]
private static void NewMenuOption()
{
}

I wish to position Item1 inside the File menu editor and after File → New Scene.

However the item is position after Exit

How can we know the priority of items of the default menu of Unity editor?

P.S.
Reading this tutorial there is the following good trick:

but I didn’t find in the unity code the priority of the File menu.

Other ideas or tricks?

1 Like

I thought I read a post a while ago talking about how some Unity menus wouldn’t let you put your entries where you wanted.
I’m not 100% certain if that’s true or not, and I’ve never tried it, but it may be.

Yes, I can’t find, at the moment, anyone made it! I hope next update of Unity editor give developers
more customization on menu item; i.e.:

  • dynamic menu creation
  • free positioning of menu
  • an easier and no tricky way for menu item creation

Old post but, i found an answer there:

you can try negative priority :wink:

3 Likes