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参数

Returns

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等。在前面,它可以有一个可选标签。

EditorGUILayout.TextField 文本字段

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();
	}
}
Page last updated: 2011-7-12