Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I reset the value of a NGUI UIInput control that marked Is Password. If I set .text to "" I still see a bunch of **** rather than the .defaultText.

Basically if the user types the wrong password during login, I want to clear the field and have is display the default text again.


If I click into the field and back out, the default text shows, but until I do that I get the ****.


// Show the Create dialog
public void ShowCreate() {

    username = loginUsername.text;
    createUsername.text = username;
    createPasswordA.text = "";
    createPasswordB.text = "";

Image: enter image description here

share|improve this question
Could you show us your actual code? Because what you describe should just work. Set the my_uiinput.text = ""; should clear it just fine. – Bart Feb 6 '13 at 13:46
It might be that the widget doesn't have the focus. Could you try setting selected to true and see if that changes anything? i.e. createPasswordA.selected = true; – Bart Feb 7 '13 at 10:01
@Bart - write that as an answer. Had to add all three to make it work right: createPasswordB.selected = true; createPasswordA.selected = true; createUsername.selected = true; – Justin808 Feb 7 '13 at 17:28
up vote 1 down vote accepted

Normally setting the text member to "" should clear the UIInput. However, for this to take effect, the widget does need to have the focus (selected needs to be true). If your widget does not immediately clear, you can set its focus manually.

In your case that would be:

createPasswordA.selected = true;
createPasswordB.selected = true;
createUsername.selected = true;

That should do the trick.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.