static function TextField (position : Rect, text : String) : String
static function TextField (position : Rect, text : String, maxLength : int) : String
static function TextField (position : Rect, text : String, style : GUIStyle) : String
static function TextField (position : Rect, text : String, maxLength : int, style : GUIStyle) : String
string - the edited string.
返回被编辑的字符串。
Description描述
Make a single-line text field where the user can edit a string.
创建单行文本字段,用户可以编辑字符串。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public string stringToEdit = "Hello World";
void OnGUI() {
stringToEdit = GUI.TextField (new Rect(10, 10, 200, 20), stringToEdit, 25);
}
}
var stringToEdit : String = "Hello World";
function OnGUI () {
// 创建一个文本字段,用户可以修改编辑。
stringToEdit = GUI.TextField (Rect (10, 10, 200, 20), stringToEdit, 25);
}