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 smirlianos · Nov 01, 2012 at 01:31 PM · javascriptinputjavadisplayuser

User input display

How I can make a screen like a text editor, but only to display what the user writes? Like a box were the user types something

Comment
Add comment · Show 1
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 smirlianos · Nov 01, 2012 at 03:12 PM 0
Share

Like a writing box or something...

1 Reply

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

Answer by Montraydavis · Nov 01, 2012 at 03:38 PM

There is only one way that >I< (and emphasis on "I") I know of is if / if else. I have done lots of searching on this topic, and, haven't really found anything. I don't mean to mislead you or anything, so, you might want to do some more searching and ask around. That, or hopefully someone else can post a better answer than this one .

 function Update ( )
 {
    if ( Input.GetKey ( KeyCode.C ) ){
       //Do GUI stuff
    }
 
    if ( Input.GetKey ( KeyCode.B ) ){
       //Do GUI stuff
    }
 
    if ( Input.GetKey ( KeyCode.C ) ){
       //Do GUI stuff
    }
 }

Alternatively, If you want to keep Update a little cleaner, just create another function to pre-store variables, or use Start ...

 var KeyArray = new Array ( ) ;
 function Start ( )
 {
    KeyArray.Add( KeyCode.A ) ;
    KeyArray.Add( KeyCode.B ) ;
    KeyArray.Add( KeyCode.C ) ;
 
 }
 
 function CheckKeys ( )
 {
    for ( var _keys ; _keys in KeyArray; _keys ++ )
    {
       if ( Input.GetKey ( KeyArray [ _keys ] ) )
       {
          //GUI CODE
       }
 
    }

    yield WaitForSeconds ( 0.1 ) ; // May cause key latency, but better performance. See if this causes an issue for you.
 }
 
 //Though I am not sure if the second method is memory efficient. You will have to test that out.
 
 function Update ( )
 {
    CheckKeys ( ) ;
 }
Comment
Add comment · Show 2 · 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 smirlianos · Nov 01, 2012 at 03:41 PM 0
Share

Thanks, I will search more! :)

avatar image Montraydavis · Nov 01, 2012 at 03:44 PM 0
Share

Not a problem. Hopefully, this will work for you until you do find something better. Good luck, and thanks for using Unity3D :)

PS: Updated code.

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

11 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

Related Questions

Input wont work!!! 0 Answers

Random numbers please help 1 Answer

how to change default third player controls in unity, to work with touch? 1 Answer

Need a link to a Machine gun Script Please 1 Answer

How do I display the contents of a class in a Label 0 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