「Unity/Editor/メニュー追加」の版間の差分
提供: 初心者エンジニアの簡易メモ
| 行17: | 行17: | ||
} | } | ||
</pre> | </pre> | ||
| + | |||
| + | ==namespace name 'MenuItem'エラーが出る場合== | ||
| + | 以下エラーが出るとき | ||
| + | namespace name 'MenuItem' could not be found (are you missing a using directive or an assembly reference?) | ||
| + | using UnityEditor;を追加 | ||
2021年8月6日 (金) 16:16時点における版
Assets/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;を追加
