MenuCommand 菜单命令
Used to extract the context for a MenuItem. MenuCommand objects are passed to custom menu item functions defined using the MenuItem attribute.
用于获得上下文菜单项。MenuCommand对象传自定义菜单项函数,使用MenuItem属性递定义。
Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script.
注意:这是一个编辑器类,如果想使用它你需要把它放到工程目录下的Assets/Editor文件夹下。编辑器类在UnityEditor命名空间下。所以当使用C#脚本时,你需要在脚本前面加上 "using UnityEditor"引用。
// Add context menu named "Something" to context menu
//添加上下文菜单名为Something 到上下文菜单
@MenuItem ("CONTEXT/Rigidbody/Do Something")
static function Something (command : MenuCommand) {
var body : Rigidbody = command.context;
body.mass = 5;
}
参见: MenuItem
Variables变量
-
Context is the object that is the target of a menu command.
上下文是一个菜单命令的目标对象。 -
An integer for passing custom information to a menu item.
传递自定义信息到一个菜单项的整数。
Constructors构造器
-
Creates a new MenuCommand object.
创建一个新的菜单命令对象。
最后修改:2011年6月27日 Monday 14:37