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

20k views Asked by At

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.

4

There are 4 answers

0
Ingo Schwarz On

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/

0
Nick Roberts On

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

0
AudioBubble On

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

0
mayo On

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