Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Pranoy-Parimal · May 07, 2014 at 01:58 PM · gui

GUI.PasswordField getting erased after clicking on the PasswordField.

Hello everyone

I am facing a unique problem while using the following line of code.

 data.password = GUI.PasswordField(Rect(screenWidth * 0.29, screenHeight * 0.58, screenWidth * 0.6, screenHeight * 0.05), data.password, "*"[0], 16);



This problem is specifically found in the iOS build of the project. First I tap on the Password text field, a key board appears where I type the password & the password appears in the password text field in the form of *(Asterik). When I am finished typing, instead of pressing the return key or Done key on the key board, I click the password text field again. Now, what was written previously in the Password field gets erased. But this doesn't happen when I click the done button or return key in the key board, & then touch the password field. I have no idea what's going on here.

It;s driving me crazy. I will appreciate any help regarding this. I am tesing on iPad iOS 7.1.1

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image thornekey · May 07, 2014 at 02:12 PM 0
Share

please reformat ur code to UA standards.

avatar image Kacheek · May 07, 2014 at 02:18 PM 0
Share

why do you not want it to be erased to begin with? you wont be able to read what you wrote so theres no need to edit it aftwards anyway... if you for example want to login you enteder your username and your password than you click login and the login menu will dissapper if you want to change your password after you entered something in the password box you will most likely erase the whole stuff you wrote anyway because you can't be sure if its right so why not leave it as it is? ;)

But well you seem to really want to do that...

 data.password = GUI.PasswordField(Rect(screenWidth * 0.29, screenHeight * 0.58, screenWidth * 0.6, screenHeight * 0.05), data.password, "*"[0], 16);
 
 string temppassword = "";
 
 if (data.password != "")
 temppassword = data.password;
 
 if(temppassword != "" && data.password =="")
 data.password = temppassword;


i hope it helps ! :)

it will just store the password into a temp variable when its not empty and if the passwordfield gets empty itll be applied to the passwordfield BUT dont put the new variable in the update function like it is here ! put it at the top of your script !

avatar image Pranoy-Parimal · May 08, 2014 at 11:03 AM 0
Share

Actually the page where I am entering the password is like a registration page. There are four textFields in it. After entering the password in the password field, when I touch the retype Password field, the password written in the password field gets erased.

This is what I don't to happen. Please help me.

avatar image nastasache · May 08, 2014 at 01:44 PM 0
Share

This is a working structure:

 using UnityEngine;
 using System.Collections;
 
 public class Join : $$anonymous$$onoBehaviour {
     
     string userPassword = "";
     string retypePassword = "";    
     
     void OnGUI() {
 
         userPassword = GUI.PasswordField(new Rect(0,10,100,24), userPassword, "*"[0], 16);
         retypePassword = GUI.PasswordField(new Rect(0,50,100,24), retypePassword, "*"[0], 16);
     }
 }

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

Limit on GUI Components? 0 Answers

Unity editor works but the built game doesnt. 0 Answers

GUI Text as Button 1 Answer

HorizontalScrollbar not appearing in GUILayout.BeginScrollview C# 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges