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
1
Question by robert 3 · Feb 15, 2011 at 05:55 PM · guitextfieldpasswordfield

gui text and password field

var username : String; var password : String; var table1 : boolean; var table2 : boolean; var window1 : Rect = Rect(20,20,500,500);

function Start() { table1 = true; }

function OnGUI() { if(table2 == true) { window1 = GUI.Window(0,window1,firstwindow,"LOGIN WINDOW"); } if(table1 == true) { GUI.color = Color.green; GUI.Label(Rect(Screen.width*(2/6.55),Screen.height*(1.9/6.3),Screen.width* (1/6.55),Screen.height*(.6/6.3)),"USER"); GUI.Label(Rect(Screen.width*(2/6.55),Screen.height*(2.5/6.3),Screen.width*(1/6.55),Screen.height*(.6/6.3)),"PASSWORD"); username = GUI.TextArea(Rect(Screen.width*(3/6.55),Screen.height*(1.9/6.3),Screen.width*(1.5/6.55),Screen.height*(.3/6.3)),username,15); password = GUI.PasswordField(Rect(Screen.width*(3/6.55),Screen.height*(2.5/6.3),Screen.width*(1.5/6.55),Screen.height*(.2/6.3)),password,""[0],10); if(GUI.Button(Rect(Screen.width(2.5/6.55),Screen.height*(3.5/6.3),Screen.width*(0.5/6.55),Screen.height*(.4/6.3)),"OK")) { table2 = true; table1 = false; } } }

Here my need is when user enter the USERNAME and PASSWORD and click ok button in the login window i have to display the WHAT ever user entered in in username and password field eg if user has entered username- robert and password- mathew in login window i have to display both robert and mathew like wise for all user

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by e-bonneville · Feb 15, 2011 at 05:58 PM

This just an example, you can modify it to fit your needs.

function OnGUI() {
    GUI.Label(Rect(10, 10, 100, 20), "Username is: " + username);
    GUI.Label(Rect(10, 30, 100, 20), "Password is: " + password)
}

Untested Javascript, please report any errors.

Comment
Add comment · Show 3 · Share
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 robert 3 · Feb 15, 2011 at 06:09 PM 0
Share

thanks it is working

avatar image e-bonneville · Feb 15, 2011 at 06:10 PM 0
Share

$$anonymous$$y pleasure. :)

avatar image NightmarexGR · Sep 10, 2012 at 07:12 AM 0
Share

it is missing a ";" in the end of third line

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

1 Person is following this question.

avatar image

Related Questions

GUI Text field? How do I make the text so it goes on more then one line? 1 Answer

Allow only numbers in an input field 1 Answer

GUI custom textfield cursor rendering 2 Answers

Text fields where text will scale along with resolution. 1 Answer

Change the color of a label font that's using an EditorStyle.textField style? 1 Answer


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