The MenuItem attribute has a priority argument, which defines the order in the submenu the menu item is placed in.
What’s not documented anywhere in the docs is that if the difference between two menu item’s priority is greater than 10, a line will be added.
This code:
using UnityEngine;
using UnityEditor;
public class TEST : MonoBehaviour {
[MenuItem("TEST/1", false, 1)]
public static void TEST1() {
}
[MenuItem("TEST/11", false, 11)]
public static void TEST11() {
}
[MenuItem("TEST/12", false, 12)]
public static void TEST12() {
}
}
Gives this result:
While this code:
using UnityEngine;
using UnityEditor;
public class TEST : MonoBehaviour {
[MenuItem("TEST/1", false, 1)]
public static void TEST1() {
}
[MenuItem("TEST/12", false, 12)]
public static void TEST12() {
}
}
Gives this result:
The behaviour with the dividing lines should be documented, and the order of the default elements of all the lists should be documented, so we can know where our menu items gets placed.
Information about what happens if two menu items have the same priority should also be included.
Finally; why is the variable namesd “priority”, when what the field defines is order?