unity中添加菜单栏

//创建Assets下创建cs脚本,如下:

 

using UnityEngine;

using System.Collections;
using UnityEditor;//需要使用到UnityEditor
public class WindowTest : MonoBehaviour {
    [MenuItem("MyMenu/Do Something")]  //保存后就会在unity菜单栏中出现MyMenu的菜单栏
    static void DoSomething()          //和二级目录Do Something,点击它就会执行DoSomething()方法
    {
        Debug.Log("Doing Something...");
    }
    [MenuItem("MyMenu/Do Something2")] //同理
    static void DoSomething2(){
        Debug.Log("DoSomething2()");
    }
   
}

你可能感兴趣的:(unity中添加菜单栏)