Unity/Editor/メニュー追加
提供: 初心者エンジニアの簡易メモ
Assets/Scripts/Editor/CustomMenu.cs
using UnityEngine; using UnityEditor; public class CustomMenu { [MenuItem("CustomMenu/CustomItem1 %i")] private static void CustomItem1() { Debug.Log("item1"); } [MenuItem("CustomMenu/CustomItem2 %h")] private static void CustomItem2() { Debug.Log("item2"); } }
namespace name 'MenuItem'エラーが出る場合
以下エラーが出るとき
namespace name 'MenuItem' could not be found (are you missing a using directive or an assembly reference?)
using UnityEditor;を追加