GUILayout.TextField 文本字段

static function TextField (text : string, params options : GUILayoutOption[]) : string
static function TextField (text : string, maxLength : int, params options : GUILayoutOption[]) : string
static function TextField (text : string, style : GUIStyle, params options : GUILayoutOption[]) : string
static function TextField (text : string, maxLength : int, style : GUIStyle, params options : GUILayoutOption[]) : string

Parameters参数

Returns

string - the edited string.

返回字符串类型,可编辑的字符串。

Description描述

Make a single-line text field where the user can edit a string.

创建一个单行文本字段,用户可以编辑其中的字符串。

GUILayout.TextField 文本字段

Text field in the GameView.
在游戏视图中的文本字段。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public string stringToEdit = "Hello World";
	void OnGUI() {
		stringToEdit = GUILayout.TextField(stringToEdit, 25);
	}
}
var stringToEdit : String = "Hello World";

function OnGUI () {
	// Make a text field that modifies stringToEdit.
	//创建一个文本字段,用户可以修改字符串
	stringToEdit = GUILayout.TextField (stringToEdit, 25);
}
最后修改:2011年6月14日 Tuesday 14:43

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。