using UnityEngine; using UnityEditor; using System.Collections; static public class CustomMenu { [MenuItem("Custom/Create Window", false, 9)] static public void CreateWindow(){ UICustomWindow window = EditorWindow.GetWindow<UICustomWindow>(false, "operate", true); window.maximized = false; window.maxSize = new Vector2(200, 100); window.Show(); } } public class UICustomWindow : EditorWindow { void OnGUI() { GUILayout.BeginVertical(); GUILayout.Space(4f); GUILayout.Label("文件已存在"); GUILayout.Space(6f); if (GUILayout.Button("override")) { this.Close(); } GUILayout.Space(10f); if (GUILayout.Button("append (only new key)")) { this.Close(); } GUILayout.EndVertical(); } }
运行效果