Unity3D Editor在右键弹出菜单中添加 item


   [MenuItem("Assets/StuffDoSomething")]

    static void DoubleMass(MenuCommand command)

    {


    }



三种特殊的:

  • Assets – items will be available under the “Assets” menu, asWELL using right-click inside the project view.

  • Assets/Create – items will be listed when clicking on the “Create” button in the project view (useful when adding new types that can be added to the project)

  • CONTEXT/ComponentName – items will be available by right-clicking inside the inspector of the given component.




在menu item中添加快捷键

  • % – CTRL on Windows / CMD on OSX

  • # – Shift

  • & – Alt

  • LEFT/RIGHT/UP/DOWN – Arrow keys

  • F1…F2 – F keys

  • HOME, END, PGUP, PGDN

// Add a new menu item with hotkey CTRL-SHIFT-A
 
[MenuItem("Tools/New Option %#a")]
private static void NewMenuOption()
{
}
 
// Add a new menu item with hotkey CTRL-G
 
[MenuItem("Tools/Item %g")]
private static void NewNestedOption()
{
}
 
// Add a new menu item with hotkey G
[MenuItem("Tools/Item2 _g")]
private static void NewOptionWithHotkey()
{
}


你可能感兴趣的:(Unity3D Editor在右键弹出菜单中添加 item)