Version: 5.3 (switch to 5.4b)
言語English
  • C#
  • JS

スクリプト言語

好きな言語を選択してください。選択した言語でスクリプトコードが表示されます。

GUI.PasswordField

マニュアルに切り替える
public static string PasswordField(Rect position, string password, char maskChar);
public static string PasswordField(Rect position, string password, char maskChar, int maxLength);
public static string PasswordField(Rect position, string password, char maskChar, GUIStyle style);
public static string PasswordField(Rect position, string password, char maskChar, int maxLength, GUIStyle style);

パラメーター

position テキストフィールドを描画するスクリーン上の Rect
password 編集するパスワード。この関数が返す値は以下の例のように同じ変数に格納しなおすべきです
maskChar パスワードをマスクする文字
maxLength 文字列の最大の長さ。省略した場合は無制限に入力することができます
style 使用するスタイル。省略された場合は、現在の GUISkin にある textField スタイルを使用します

戻り値

string 編集されたパスワード

説明

ユーザーがパスワードを入力することができるテキストフィールド

using UnityEngine;
using System.Collections;

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