まず、Editorフォルダーにスクリプトを作成します
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
namespace RunAndJump.LevelCreator
{
//创建自定义编辑器窗体 需要继承EditorWindow
public class PaletteWindow : EditorWindow
{
//自定义窗体一般用单例模式
#region Singleton
private static PaletteWindow instance;
public static void ShowPalette()
{
instance = EditorWindow.GetWindow<PaletteWindow>(); //GetWindow(typeof(PaletteWindow))
//设置窗体标题
instance.titleContent = new GUIContent("Palette");
}
#endregion
}
}
次に、Scriptsフォルダーの下に、メニューバーオプションを作成します
[MenuItem("Tools/Level Creator/Show Palette")]
private static void ShowPalette()
{
PaletteWindow.ShowPalette();
}
下図のような効果が得られます