For some reason I cannot find any documentation on this function, I am just curious how I can disable one of the menu items. I've seen only one example, where I guess in earlier Unity versions GUIContent had an "enabled" feature, which was used then to disable a menu item, however now GUI controls are enabled/disabled using GUI.enable, so what am I suppose to do here?
Ok, I found it. It's not part of GUIUtility, but EditorUtility. There are three versions of the function:
internal static void DisplayCustomMenu(Rect position, string selected, SelectMenuItemFunction callback, object userData) public static void DisplayCustomMenu(Rect position, GUIContent options, int selected, SelectMenuItemFunction callback, object userData) internal static void DisplayCustomMenu(Rect position, string options, bool enabled, int selected, SelectMenuItemFunction callback, object userData)
As you can see, the only version with an enabled array is the third one, and it's marked internal.
The second function calls the first, which explicitly sets all the items to enabled.
I'm guessing that all three of these functions are supposed to be internal (or perhaps all public). You should file a bug report.
I know this question is super old, but it still comes up in searches so I might as well answer it.
I don’t know why EditorUtility.DisplayCustomMenu isn’t documented, but the better way to do what you want is by using GenericMenu. With GenericMenu it’s easy to create menus that have dividers, disabled items, arbitrary hierarchies, etc.
Displaying custom menu items is most easily done with the MenuItem attribute:
As the examples show, you can use a second function to define when the item is enabled or not.