言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

ContextMenu

Namespace: UnityEngine

Description

ContextMenu属性はコンテキストメニューにコマンドを追加することが出来ます。

スクリプトがアタッチされたインスペクターで、ユーザーがコンテキストメニューを選択した時、 関数が実行されます。 これはスクリプトからシーンデータを自動的にセットアップするときにもっとも便利です。 この関数は非staticである必要があります。

@ContextMenu ("Do Something")
function DoSomething () {
	Debug.Log ("Perform operation");
}
// C# example:
public class ContextTesting : MonoBehaviour {
	/// Add a context menu named "Do Something" in the inspector
	/// of the attached script.
	[ContextMenu ("Do Something")]
	void DoSomething () {
		Debug.Log ("Perform operation");
	}
}

Constructors

ContextMenu コンポーネントのコンテキストメニューに関数を追加します