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 expand hierachry by code
下一篇Unity3D 解锁preview window 随意拖动
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭