How does the priority of a Editor menuItem change item placement?

Referring to the MenuItem.MenuItem static function; According to the scripting reference manual, "Priority defines the order by which menu items are displayed in the menu bar.". Testing it with the following code does not seem to have any impact on the placement of the menu item.

public class MenuExtensions : MonoBehaviour {

[MenuItem ("File/LalaLand", false, 0)]
static void ColladaExtract() {
    Debug.Log("Doing extraction!");
}

}

Thanks!

This is what I found out while working with custom menus:

The MenuItem's are sorted in increasing order and if you add more then 10 between two items, an Separator-Line is drawn before the menuitem.

For example, see Unity's GameObject menu (I stripped syntax to just itemName,Priority):

  • GameObject/CreateEmpty,0
    • GameObject/Create Other/Particle System,1
    • GameObject/Create Other/Camera,2
  • GameObject/Center On Children/15

Cheers Jake

It groups similar numbers together, and it appears that those are relative to increments of 50.

0 1 2 3

50 51 52 53

Unfortunately, it doesn't work (yet). I reported this bug on Christmas Eve of last year, and it's still open.

(Case 309855)

Works

@MenuItem("EventEditor/New", true)
static function FileNew () {
	return EditorWindow.focusedWindow == EventEditorWindow.window;
}

@MenuItem("EventEditor/New", false, 10)
static function FileNewPerform () {
	Debug.Log("Load");
}

@MenuItem("EventEditor/Open", true)
static function FileOpen () {
	return EditorWindow.focusedWindow == EventEditorWindow.window;
}

@MenuItem("EventEditor/Open", false, 11)
static function FileOpenPerform () {
	Debug.Log("Save");
}

@MenuItem("EventEditor/Save", true)
static function FileSave () {
	return EditorWindow.focusedWindow == EventEditorWindow.window;
}

@MenuItem("EventEditor/Save", false, 30)
static function FileSavePerform () {
	Debug.Log("Load");
}

@MenuItem("EventEditor/Save As", true)
static function FileSaveAs () {
	return EditorWindow.focusedWindow == EventEditorWindow.window;
}

@MenuItem("EventEditor/Save As", false, 30)
static function FileSaveAsPerform () {
	Debug.Log("Load");
}	


@MenuItem("EventEditor/Add/Entry", true)
static function AddEntry () {
	return EditorWindow.focusedWindow == EventEditorWindow.window;
}

@MenuItem("EventEditor/Add/Entry")
static function AddEntryPerform () {
	EventEditorWindow.window.CallbackPopup(0, ["Add", "Remove"]);
}

@MenuItem("EventEditor/Add/Trigger", true)
static function AddTrigger () {
	return EditorWindow.focusedWindow == EventEditorWindow.window;
}

@MenuItem("EventEditor/Add/Trigger")
static function AddTriggerPerform () {
	EventEditorWindow.window.CallbackPopup(1, ["Add", "Remove"]);
}

@MenuItem("EventEditor/Add/Terminal", true)
static function AddTerminal () {
	return EditorWindow.focusedWindow == EventEditorWindow.window;
}

@MenuItem("EventEditor/Add/Terminal")
static function AddTerminalPerform () {
	EventEditorWindow.window.CallbackPopup(2, ["Add", "Remove"]);
}

MenuItem

It works

@MenuItem("EventEditor/New", true)
static function FileNew () {
	return EditorWindow.focusedWindow == EventEditorWindow.window;
}
@MenuItem("EventEditor/New", false, 10)
static function FileNewPerform () {
	Debug.Log("Load");
}
@MenuItem("EventEditor/Open", true)
static function FileOpen () {
	return EditorWindow.focusedWindow == EventEditorWindow.window;
}
@MenuItem("EventEditor/Open", false, 11)
static function FileOpenPerform () {
	Debug.Log("Save");
}
@MenuItem("EventEditor/Save", true)
static function FileSave () {
	return EditorWindow.focusedWindow == EventEditorWindow.window;
}
@MenuItem("EventEditor/Save", false, 30)
static function FileSavePerform () {
	Debug.Log("Load");
}
@MenuItem("EventEditor/Save As", true)
static function FileSaveAs () {
	return EditorWindow.focusedWindow == EventEditorWindow.window;
}
@MenuItem("EventEditor/Save As", false, 31)
static function FileSaveAsPerform () {
	Debug.Log("Load");
}	

alt text