当前位置:网站首页>[unity Editor Extension Foundation], editorguilayout (I)
[unity Editor Extension Foundation], editorguilayout (I)
2022-06-28 12:21:00 【Unique_ eight hundred and forty-nine million nine hundred and n】
Summary :
1、EditorGUILayout Various Field and GUILayout Similar , however EditorGUILayout You can copy and paste ;
2、 because OnGUI Is executed every frame ,EditorGUILayout It's similar to TextField、IntSlider、ColorField Need to pass a value , Returns the modified value , You need to assign the return value to a temporary variable ;
3、params GUILayoutOption[] options The parameters that can be passed are GUILayout Class : GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
4、DelayedField Delayed input fields Before pressing the Enter key or moving the focus away from the text field , No new value will be returned .
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
AnimationCurve m_curve = AnimationCurve.Linear(0, 0, 10, 10);
//DelayedDoubleField DelayedFloatField DelayedIntField DelayedTextField
double m_delayedDouble = 0;
float m_delayedFloat = 0;
int m_delayedInt = 0;
string m_delayedString = "";
//DoubleField FloatField IntField TextField
double m_fieldDouble = 0;
float m_fieldFloat = 0;
int m_fieldInt = 0;
string m_fieldString = "";
long m_fieldLong = 0;
//LayerField
int selectedLayer = 0;
//ObjectField
Object m_fieldObject;
//MaskField
int flags = 0;
string[] options = new string[] { "CanJump", "CanShoot", "CanSwim" };
//TagField
string tagStr = "Untagged";
//RectField
Rect m_rectFieldPos;
#endregion
[MenuItem("EditorGUILayout/EditorGUILayoutFieldExample")]
static void Init()
{
EditorGUILayoutFieldExample window = (EditorGUILayoutFieldExample)EditorWindow.GetWindow(typeof(EditorGUILayoutFieldExample));
window.Show();
}
void OnGUI()
{
#region Field Input box
//BoundsField Boundary input box
_bounds = EditorGUILayout.BoundsField("BoundsField:",_bounds);
//ColorField Color input box
m_color = EditorGUILayout.ColorField("ColorField:",m_color);
//CurveField Curve input box
m_curve = EditorGUILayout.CurveField("CurveField:", m_curve);
//DelayedField
m_delayedDouble = EditorGUILayout.DelayedDoubleField("DelayedDoubleField:", m_delayedDouble);
m_delayedFloat = EditorGUILayout.DelayedFloatField("DelayedFloatField:", m_delayedFloat);
m_delayedInt = EditorGUILayout.DelayedIntField("DelayedIntField:", m_delayedInt);
m_delayedString = EditorGUILayout.DelayedTextField("DelayedTextField:", m_delayedString);
m_fieldDouble = EditorGUILayout.DoubleField("DoubleField:", m_fieldDouble);
m_fieldFloat = EditorGUILayout.FloatField("FloatField:", m_fieldFloat);
m_fieldInt = EditorGUILayout.IntField("IntField:", m_fieldInt);
m_fieldString = EditorGUILayout.TextField("TextField:", m_fieldString);
m_fieldLong = EditorGUILayout.LongField("LongField:", m_fieldLong);
//LabelField
EditorGUILayout.LabelField(" This is a LabelField! ");
//LayerField You can get all of Layer
selectedLayer = EditorGUILayout.LayerField("LayerField:", selectedLayer);
//ObjectField
m_fieldObject = EditorGUILayout.ObjectField(m_fieldObject, typeof(Object), true);
//MaskField
flags = EditorGUILayout.MaskField("MaskField:", flags, options);
//RectField
m_rectFieldPos = EditorGUILayout.RectField("RectField:", m_rectFieldPos);
//TagField
tagStr = EditorGUILayout.TagField("TagField:", tagStr);
#endregion
}
}
That's all EditorGUILayout All kinds of Field The use of .
design sketch :

边栏推荐
- 【北京航空航天大学】考研初试复试资料分享
- MapReduce项目案例1
- 深度学习又有新坑了!悉尼大学提出全新跨模态任务,用文本指导图像进行抠图...
- CDC synchronization if the primary key of a database table changes, will it be synchronized into two data or will it be synchronized to update the primary key?
- IDEA全局搜索快捷设置
- KDD 2022 | 图“预训练、提示、微调”范式下的图神经网络泛化框架
- 关于字符串转换的一些小技巧
- 华泰证券开户安全吗? 开户有风险吗
- cdc同步 如果数据库表的主键发生了变化,会同步成两个数据 还是会同步更新主键呢?
- 什么是泛型,怎么使用泛型分析
猜你喜欢

EMC RS485 interface EMC circuit design scheme

How to deploy the software testing environment?

洛谷_P1303 A*B Problem_高精度计算
![Connectionreseterror: [winerror 10054] the remote host forced an existing connection to be closed](/img/9a/97813f5ac4d7c15711891cff25b9dd.jpg)
Connectionreseterror: [winerror 10054] the remote host forced an existing connection to be closed

What is the difference between internal oscillator, passive crystal oscillator and active crystal oscillator?

【C语言】判断三角形

. Net hybrid development solution 24 webview2's superior advantages over cefsharp

【Unity编辑器扩展基础】、EditorGUILayout (一)

【Unity编辑器扩展基础】、GUI

【北京航空航天大学】考研初试复试资料分享
随机推荐
Three ways to implement LRU cache (recommended Collection)
Leetcode 705. 设计哈希集合
What are the common modes of financial products in 2022?
内部振荡器、无源晶振、有源晶振有什么区别?
什么是泛型,怎么使用泛型分析
Cohere, a large model company, completed the round B financing of US $125million
AcWing 609. Salary (implemented in C language)
【附源码+代码注释】误差状态卡尔曼滤波(error-state Kalman Filter),扩展卡尔曼滤波,实现GPS+IMU融合,EKF ESKF GPS+IMU
5. Sum of N numbers
Many benefits of SEO optimization are directly related to traffic
PrecomputedTextCompat用法及原理
【C语言】如何很好的实现复数类型
Given two points and a point with a middle scale, find the coordinates of the point
AcWing 606. Average 1 (implemented in C language)
已知两个点和中间一个比例的点,求该点坐标
【Unity编辑器扩展基础】、EditorGUILayout (三)
双缓冲绘图
[C language] three sorting methods for random number files
设置Canvas的 overrideSorting不生效
Using MySQL database in the express framework of node