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
string - the edited string.
返回字符串类型,可编辑的字符串。
Description描述
Make a single-line text field where the user can edit a string.
创建一个单行文本字段,用户可以编辑其中的字符串。
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);
}