EditorWindow

作者:追风剑情 发布于:2014-7-30 21:00 分类:Unity3d

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();
    }
}

运行效果

CreateWindow.png

标签: GUI

Powered by emlog  蜀ICP备18021003号   sitemap

川公网安备 51019002001593号