今天我们制作自定义Unity菜单。不多说,直接上代码:
using UnityEditor;
using UnityEngine;public class Menu
{
[MenuItem("YouyouTools/Settings")]
public static void Settings()
{
SettingsWindow win = (SettingsWindow)EditorWindow.GetWindow(typeof(SettingsWindow));
win.titleContent = new GUIContent("标题");
win.Show();
}
}
恩,自定义菜单成功。
接下来在弹框中,制作内容:
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class SettingsWindow : EditorWindow
{
private string danXuan= "danXuan";
string myString = "Hello World";
bool groupEnabled;
bool myBool = true;
float myFloat = 1.23f;
private void OnGUI()
{
//开启一行