Atilla Gundogan
Atilla Gundogan

Reputation: 101

Password InputField Censored (****) - Logging and Registration

I am planning to do logging and registration. But I have a problem. I can't make the password InputField became like ***** (censored).

And maybe it wouldn't affect your answers but my game will be on the android platform.

Here is the sample image

Thank you.

Upvotes: 7

Views: 20802

Answers (4)

user8660752
user8660752

Reputation:

now you have a property in unity than you can change directly change . you select content type in Input field text and your value is changeenter image description here

Upvotes: 25

mayo
mayo

Reputation: 4075

What about using InputField of the new UI ? You can set the content to Password:

Doc:

http://docs.unity3d.com/es/current/Manual/script-InputField.html

Upvotes: 0

Nick Roberts
Nick Roberts

Reputation: 245

Try something like

public string thePassword = "12345";
void OnGUI()
{
    passwordToEdit = GUI.PasswordField(new Rect(10, 10, 200, 20), 
                                       passwordToEdit, "*"[0], 25);
}

PasswordField Parameter List

  1. Where you would like the box.
  2. Your password to mask.
  3. The character to mask the password characters with.
  4. (Optional) Max masking length.
  5. (Optional) The textfield style.

Source: Unity Scripting API

Upvotes: 0

Ingo Schwarz
Ingo Schwarz

Reputation: 607

Just use a EditText and set its inputType="textPassword

Herr is also an example to do so: http://www.mkyong.com/android/android-password-field-example/

Upvotes: 2

Related Questions