GUI.PasswordField 密码字段

static function PasswordField (position : Rect, password : String, maskChar : char) : String
static function PasswordField (position : Rect, password : String, maskChar : char, maxLength : int) : String
static function PasswordField (position : Rect, password : String, maskChar : char, style : GUIStyle) : String
static function PasswordField (position : Rect, password : String, maskChar : char, maxLength : int, style : GUIStyle) : String

Parameters参数

Returns 返回

string - the edited password.
返回被编辑的密码。

Description描述

Make a text field where the user can enter a password.

创建文本字段,用户可以编辑密码。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public string passwordToEdit = "My Password";
	void OnGUI() {
		passwordToEdit = GUI.PasswordField(new Rect(10, 10, 200, 20), passwordToEdit, "*"[0], 25);
	}
}
var passwordToEdit : String = "My Password";

function OnGUI () {
	// 创建一个密码字段,用户可以编辑密码
	passwordToEdit = GUI.PasswordField (Rect (10, 10, 200, 20), passwordToEdit, "*"[0], 25);
}
Page last updated: 2011-1-14