
Each item in Unity’s menus has an unknown sort priority, so finding where to place your item can be annoying.

Sorting menu items can be a bit of guesswork.

You can optionally assign a hotkey by specifying a keycode after a space in the item name (see Unity’s scripting API for hotkey keycodes).Spaces are allowed in all menu names as well as the item name.You must specify a root menu and an Item Name.

If root is an existing Menu name (“Assets”, “Window”, etc) your item will be added to that menu (except for Component - more on that later).Some additional notes on the Path parameter: The format of the path parameter is as follows: “Root Menu/Sub Menu1/Sub Menu2/Item Name ”.Įxample usage for MenuItem attribute: Path - String that specifies the menu and name for your menu item.See Unity’s documentation on special folder names if you are unfamiliar with that. MenuItem attribute is in the UnityEditor namespace, so you need to include that namespace and place your script in a folder named Editor. To assign a method to a custom menu item you simply add the attribute to a static method (if you are unfamiliar with attributes, see the MSDN documentation.) The method’s accessibility (public / private), return type, and name do not matter.
