EditorWindow类在UnityEdior下,所以要using UnityEditor;
using UnityEngine;
using System.Collections;
using UnityEditor;
public class TaskWindow:EditorWindow //窗口类型,一定要继承自EditorWindow
{
[MenuItem("Window/TaskWindow")] //在Unity菜单Window下添加一个TaskWindow选项
static void Init()
{
TaskWindow taskWindow = EditorWindow.GetWindow(typeof(TaskWindow),false,"TaskWindow",true);//创建窗口
taskWindow.Show(); //显示窗口
}
}