- 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.TextField 文本字段
static function TextField (text : string, params options : GUILayoutOption[]) : string
static function TextField (text : string, style : GUIStyle, params options : GUILayoutOption[]) : string
static function TextField (label : string, text : string, params options : GUILayoutOption[]) : string
static function TextField (label : string, text : string, style : GUIStyle, params options : GUILayoutOption[]) : string
static function TextField (label : GUIContent, text : string, params options : GUILayoutOption[]) : string
static function TextField (label : GUIContent, text : string, style : GUIStyle, params options : GUILayoutOption[]) : string
Parameters参数
-
labelOptional label in front of the toggle. // 开关按钮前面的可选标签。
-
textThe text to edit. // 编辑的文本
- 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 text entered by the user.
返回字符串,用户输入的文本。
Description描述
Make a text field.
制作一个文本字段。
This works just like GUILayout.TextField, but correctly responds to select all, copy, paste etc. in the editor, and it can have an optional label in front.
就像GUILayout.TextField,但正确响应select all,copy,paste等。在前面,它可以有一个可选标签。
Changes the name of the selected GameObject.
改变选择游戏物体的名称。
// Automatically change the name of the selected object via a text field
//通过字段,自动改变选择物体的名字
class EditorGUILayoutTextField extends EditorWindow {
var objectName : String = "";
@MenuItem("Examples/GUILayout TextField")
static function Init() {
var window = GetWindow(EditorGUILayoutTextField);
window.Show();
}
function OnGUI() {
GUILayout.Label("Select an object in the hierarchy view");
if(Selection.activeGameObject)
Selection.activeGameObject.name =
EditorGUILayout.TextField("Object Name: ", Selection.activeGameObject.name);
this.Repaint();
}
}