お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。
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.
Closeコンポーネントのコンテキストメニューに関数を追加します
スクリプトがアタッチされたインスペクターで、ユーザーがコンテキストメニューを選択した時、 関数が実行されます。 これはスクリプトからシーンデータを自動的にセットアップするときにもっとも便利です。 この関数は非staticである必要があります。
@ContextMenu ("Do Something") function DoSomething () { Debug.Log ("Perform operation"); }
// C# example: 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"); } }