1.创建Editor文件夹.
2.创建自定义菜单栏类.名字可根据自己需求取名,我这里是"MenuItems"
using UnityEngine;
using UnityEditor;
using System.Collections;
public class MenuItems : MonoBehaviour
{
//自定义菜单
[MenuItem("EasyButton/AddEventTriggerL")]
static void A1()
{
//菜单按钮点击执行代码,给当前选中对象加个脚本
Selection.activeGameObject.AddComponent<EventTriggerListener>();
}
//自定义菜单
[MenuItem("EasyButton/EasyButton")]
static void A2()
{
//菜单按钮点击执行代码,给当前选中对象加个脚本
Selection.activeGameObject.AddComponent<EasyButton>();
}
}
不用运行,unity自动编译后,会出现
自定义菜单就做好了,你可以根据自己的需求制作想要的菜单和功能.