Version: 5.4

MenuCommand

class in UnityEditor

マニュアルに切り替える

説明

MenuItem でコンテキストを展開するために使用されます。MenuCommand オブジェクトは、MenuItem 属性を使用して定義されたカスタムメニューアイテムの関数に渡されます。

// Add context menu named "Something" to context menu
@MenuItem ("CONTEXT/Rigidbody/Do Something")
static function Something (command : MenuCommand) {
	var body : Rigidbody = command.context;
	body.mass = 5;
	Debug.Log ("Changed Rigidbody's Mass to " + body.mass + " from Context Menu...");
}

関連項目: MenuItem.

変数

contextコンテキストはメニューコマンドのターゲット(現在選択しているオブジェクト、など)となるオブジェクトです
userDataメニューアイテムにカスタム情報を渡すための integer

コンストラクタ

MenuCommand新規の MenuCommand オブジェクトを作成します
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961