标签:
using UnityEngine;
using System.Collections;
using UnityEditor; // 编辑器命名空间的引用
public class Editor2 : EditorWindow // 编辑器类
{
bool _toggle;
Color _color;
string _string;
AnimationCurve _animationCurve = new AnimationCurve();
[MenuItem("EditorDemo/CreateWindow")] // 在编辑器中添加一个菜单
static void CreateWindow() // 下面这个函数必须是***静态的***
{
// 在这里面创建窗口
EditorWindow.GetWindow(typeof(Editor2), false, "EditorWindow", true);
}
void OnGUI()
{
_toggle = EditorGUILayout.BeginToggleGroup("Toggle", _toggle); // 组开始
_color = EditorGUILayout.ColorField("Color", _color); // 组中的内容
_string = EditorGUILayout.TextField("Text", _string);
EditorGUILayout.EndToggleGroup(); // 组结束
_animationCurve = EditorGUILayout.CurveField("AnimationCurve", _animationCurve); // 组外的内容
}
}
2. BoundsField(在接下去的一些创建Field的函数介绍,小贱主要讲函数的必要参数和GUI的表现形式)
“Bounds”是该区域的名称,_bounds是一个Bounds类型的变量
Bounds描述的一个以Center为中心点坐标,Extents为边界信息的长方体边框。
3. ColorField
(转)Unity笔记之编辑器(BeginToggleGroup、BoundsField、ColorField) ...
标签:
原文地址:http://www.cnblogs.com/backlighting/p/5061580.html