资源描述
MenuItem自定义菜单项
Posted on 2013年07月27日 by U3d / Unity3D脚本/插件 /被围观 6 次
在编辑器添加一个自定义菜单项(用法:[MenuItem(“DuanEditor/init Scenes”)])
例:菜单项启动一个自定义的编辑器窗口(EditorWindow ),该窗口试用OnGUI布局。
using UnityEngine; using System.Collections; using UnityEditor; public class initScenes : EditorWindow { [MenuItem("DuanEditor/init Scenes")] static void Init() { initScenes window = (initScenes)EditorWindow.GetWindow(typeof(initScenes)); window.Show(); } void OnGUI() { if (GUI.Button(new Rect(10,10,200,20),"hello world")) { Debug.Log("hello world"); } } }
展开阅读全文