小结:
1、EditorGUILayout的各种Field和GUILayout的类似,但是EditorGUILayout可以复制粘贴;
2、因为OnGUI是每帧执行的,EditorGUILayout中类似TextField、IntSlider、ColorField需要传一个值,返回修改值的,需要将返回值赋值给临时变量;
3、params GUILayoutOption[] options可以传的参数在GUILayout类中可以找到: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
4、DelayedField延迟的输入框 在按下回车键或将焦点从文本字段移开之前,不会返回新值。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class EditorGUILayoutFieldExample : EditorWindow
{
#region Field
//BoundsField
static Vector3 center = new Vector3(1, 2, 3);
static Vector3 size = new Vector3(1, 2, 3);
Bounds _bounds = new Bounds(center, size);
//ColorField
Color m_color = Color.white;
//CurveField
An