お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。
Namespace: UnityEngine
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseContextMenu属性はコンテキストメニューにコマンドを追加することが出来ます。
スクリプトがアタッチされたインスペクターで、ユーザーがコンテキストメニューを選択した時、 関数が実行されます。 これはスクリプトからシーンデータを自動的にセットアップするときにもっとも便利です。 この関数は非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"); } }
ContextMenu | コンポーネントのコンテキストメニューに関数を追加します |