画像のようなInspectorのMenuItemの拡張方法を覚えてなかったのでメモがてら記事を書きます。
コンポーネントを指定しての記述
Unityの定義コンポーネントやContextをまとめたい場合などの場合の記述
[MenuItem("CONTEXT/{Component}/{MenuName}")] private static void CustomContextMenu(MenuCommand menuCommand) { var c = menuCommand.context as Component; }
そのコンポーネント内
using UnityEngine; public class ContextSample : MonoBehaviour { [ContextMenu("Sample")] private void CustomContextMenu() { } }