- BeginHorizontal
- BeginScrollView
- BeginToggleGroup
- BeginVertical
- BoundsField
- ColorField
- CurveField
- EndHorizontal
- EndScrollView
- EndToggleGroup
- EndVertical
- EnumPopup
- FloatField
- Foldout
- InspectorTitlebar
- IntField
- IntPopup
- IntSlider
- LabelField
- LayerField
- MinMaxSlider
- ObjectField
- PasswordField
- Popup
- PrefixLabel
- PropertyField
- RectField
- SelectableLabel
- Slider
- Space
- TagField
- TextArea
- TextField
- Toggle
- Vector2Field
- Vector3Field
- Vector4Field
EditorGUILayout.TagField 标签字段
static function TagField (tag : string, params options : GUILayoutOption[]) : string
static function TagField (tag : string, style : GUIStyle, params options : GUILayoutOption[]) : string
static function TagField (label : string, tag : string, params options : GUILayoutOption[]) : string
static function TagField (label : string, tag : string, style : GUIStyle, params options : GUILayoutOption[]) : string
static function TagField (label : GUIContent, tag : string, params options : GUILayoutOption[]) : string
static function TagField (label : GUIContent, tag : string, style : GUIStyle, params options : GUILayoutOption[]) : string
Parameters参数
-
labelOptional label in front of the field. // 字段前面的可选标签。
-
tagThe tag the field shows. // 显示字段的标签
- styleOptional GUIStyle. // 可选样式
-
optionsAn optional list of layout options that specify extra layouting properties. Any values passed in here will override settings defined by the style. See Also: GUILayout.Width, GUILayout.Height, GUILayout.MinWidth, GUILayout.MaxWidth, GUILayout.MinHeight, GUILayout.MaxHeight, GUILayout.ExpandWidth, GUILayout.ExpandHeight
指定额外布局属性的可选列表。这里传递任意值,将覆盖样式定义的设置。
string - The tag selected by the user.
返回字符串,用户选择的标签。
Description描述
Make a tag selection field.
制作一个标签选择字段。
Assign tags on the selected GameObjects
在选择的游戏物体指定标签。
// Simple editor script that lets you set a tag for the selected GameObjects.
//为选择的游戏物体设置标签
class EditorGUILayoutTagField extends EditorWindow {
var tagStr = "";
@MenuItem("Examples/Set Tags For Selection")
static function Init() {
var window = GetWindow(EditorGUILayoutTagField);
window.Show();
}
//Disable menu if we dont have at least 1 gameobject selected
//如果没有选择游戏物体,禁用菜单
@MenuItem("Examples/Set Tags For Selection", true)
static function ValidateSelection() {
return Selection.activeGameObject != null;
}
function OnGUI() {
tagStr = EditorGUILayout.TagField("Tag for Objects:",tagStr);
if(GUILayout.Button("Set Tag!"))
SetTags();
}
function SetTags() {
for(var go : GameObject in Selection.gameObjects)
go.tag = tagStr;
}
}