Version: 2021.3
控件
Custom controls

控件参考

下表是为 UI 工具包提供的所有内置控件的参考。

控件 描述 Bindable Data Type 命名空间 基类
BoundsField 边界值输入字段 UnityEngine.Bounds UnityEditor.UIElements BaseField<Bounds>
BoundsIntField 整数边界值输入字段 UnityEngine.BoundsInt UnityEditor.UIElements BaseField<BoundsInt>
Box 一个简单的轮廓容器元素 UnityEngine.UIElements VisualElement
Button 按下时执行操作的可点击文本元素 string UnityEngine.UIElements TextElement
ColorField 允许选择颜色的颜色值输入字段 UnityEngine.Color UnityEditor.UIElements BaseField<Color>
CurveField 显示曲线预览的曲线值输入字段 UnityEngine.AnimationCurve UnityEditor.UIElements BaseField<AnimationCurve>
DoubleField 双精度值输入字段 double UnityEditor.UIElements TextValueField<double>
EnumField 显示下拉列表的枚举值输入字段 Enum UnityEditor.UIElements BaseField<Enum>
EnumFlagsField 具有 Flag 属性的枚举值输入字段 Enum UnityEngine.UIElements BaseMaskField<Enum>
FloatField 浮点值输入字段 float UnityEditor.UIElements TextValueField<float>
Foldout 创建可折叠部分的容器元素 bool UnityEngine.UIElements BindableElement
GradientField 一个梯度值输入字段 UnityEngine.Gradient UnityEditor.UIElements BaseField<Gradient>
Image 可表示图像或纹理的简单元素 UnityEngine.UIElements VisualElement
IntegerField 整数值输入字段 int UnityEditor.UIElements TextValueField<int>
Label 静态文本元素 string UnityEngine.UIElements TextElement
LayerField 允许选择一个层的弹出选择字段 int UnityEditor.UIElements PopupField<int>
LayerMaskField 允许选择一个或多个层的弹出选择字段 int UnityEditor.UIElements MaskField
ListView 可将项目显示为可重新排序的列表的容器元素 IList, UnityEngine.VisualElement UnityEngine.UIElements BindableElement
LongField 长整型值输入字段 long UnityEditor.UIElements TextValueField<long>
MaskField 允许选择一个或多个项目的弹出选择字段 int UnityEditor.UIElements BaseMaskField<int>
MinMaxSlider 可表示范围的基于浮点数的滑动条输入字段 UnityEngine.Vector2 UnityEngine.UIElements BaseField<Vector2>
ObjectField UnityEngine.Object 值输入字段 UnityEngine.Object UnityEditor.UIElements BaseField<Object>
PopupField<T> 弹出选择输入字段 typeof(T) UnityEditor.UIElements BasePopupField<T, T>
PopupWindow 与 EditorGUILayout.Popup IMGUI 元素匹配的弹出选择字段 string UnityEngine.UIElements TextElement
ProgressBar 显示任务进度的元素 float, int UnityEditor.UIElements BindableElement
PropertyField 基于绑定序列化属性类型的值输入字段 多种 UnityEditor.UIElements VisualElement
RectField 矩形/大小值输入字段 UnityEngine.Rect UnityEditor.UIElements BaseCompositeField<Rect, FloatField, float>
RectIntField 基于整数的矩形/大小值输入字段 UnityEngine.RectInt UnityEditor.UIElements BaseCompositeField<RectInt, IntegerField, int>
RepeatButton 按下时反复执行某项操作的可点击文本元素 string UnityEngine.UIElements TextElement
Scroller 水平或垂直滚动条元素 UnityEngine.UIElements VisualElement
ScrollView 在可滚动框架中显示其内容的容器元素 UnityEngine.UIElements VisualElement
Slider 基于浮点数的范围边界滑动条输入字段 float UnityEngine.UIElements BaseSlider<float>
SliderInt 基于整数的范围边界滑动条输入字段 int UnityEngine.UIElements BaseSlider<int>
TagField 允许单选标签项的弹出选择字段 string UnityEditor.UIElements PopupField<string>
TextElement 通用文本元素 string UnityEngine.UIElements BindableElement
TextField 字符串值输入字段 string UnityEngine.UIElements TextInputBaseField<string>
Toggle 可表示二进制状态的可点击复选框 bool UnityEngine.UIElements BaseField<bool>
Toolbar 可在工具窗口中显示工具的容器元素 UnityEditor.UIElements VisualElement
TreeView 可将项目显示为树的容器元素 UnityEngine.UIElements VisualElement
Vector2Field 二维矢量值输入字段 UnityEngine.Vector2 UnityEditor.UIElements BaseCompositeField<Vector2, FloatField, float>
Vector2IntField 基于整数的二维矢量值输入字段 UnityEngine.Vector2Int UnityEditor.UIElements BaseCompositeField<Vector2Int, IntegerField, int>
Vector3Field 三维矢量值输入字段 UnityEngine.Vector3 UnityEditor.UIElements BaseCompositeField<Vector3, FloatField, float>
Vector3IntField 基于整数的三维矢量值输入字段 UnityEngine.Vector3Int UnityEditor.UIElements BaseCompositeField<Vector3Int, IntegerField, int>
Vector4Field 四维矢量值输入字段 UnityEngine.Vector4 UnityEditor.UIElements BaseCompositeField<Vector4, FloatField, float>
控件
Custom controls