您的位置:首页 > 移动开发 > Unity3D

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

2015-07-07 14:28 756 查看
   [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()
{
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: