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:
If it is required to add and organize menu items under existing Unity menus, a bit of “guess work” is needed, as most of the built-in menu items use priorities. Another option is to use a tool such as Reflector and look at the source code for internal Unity code (such as UnityEditor.CreateBuildInWindows) that is responsible for creating some of the menus in the editor.
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
Mr_Mow
June 29, 2018, 11:04am
4
Old post but, i found an answer there:
you can try negative priority
3 Likes