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 RafaelVazquez · Jun 02, 2012 at 06:41 PM · guiinputtextfield

Input not registering while TextField is selected

Hi everybody, I've been having problems with the TextField function and I'm not really sure how to solve it. I'm creating a typer game prototype, where the player writes types actions in a textField. The idea is for players to type their action and then press 'Return' to submit the string to the system. The problem comes from the fact that, if the textField is selected, Input.GetKey() does not register the 'Return' key. It is not until the user clicks outside the text field that Input starts registering keys again. I could place a button next to the text field, but I want the game to be keyboard only. Does anyone have any suggestions so I can listen to other keys while the TextField is selected? Any info, or other solution you can think of would really help.

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

3 Replies

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

Answer by Bunny83 · Jun 02, 2012 at 06:43 PM

Strangely they removed Input-eatKeyPressOnTextFieldFocus from the Input documentation. However this has been asked several times:

http://answers.unity3d.com/questions/136063/cant-input-when-focus-a-text-field.html
http://answers.unity3d.com/questions/214041/closing-textfield-via-inputgetkeydown-not-working.html

Comment
Add comment · Show 1 · 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 RafaelVazquez · Jun 03, 2012 at 03:29 PM 0
Share

Hey thanks a bunch. I look through the forums for similar questions but couldn't find them. Thanks for pointing me in the right direction.

avatar image
0

Answer by BitFish · Jun 21, 2012 at 06:52 PM

This has worked well for me:

 text = GUI.TextField(new Rect(0,0,100,400), text);

 bool enterClicked = text.Contains("\r") || text.Contains("\n");

 nameField = nameField.Trim('\r', '\n');

 if(enterClicked) DoSomething();
Comment
Add comment · 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
0

Answer by unimechanic · Jul 03, 2013 at 04:12 PM

This example should help:

http://forum.unity3d.com/threads/188202-Simple-dynamic-list-editor

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

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

7 People are following this question.

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

Related Questions

Get key state while textfield has focus? 0 Answers

TextField, Event.current, Input.GetKey, and GUI.FocusControl locking 1 Answer

Android Textfield locks out input until esc 2 Answers

Backspace in limited length textfield causes ArgumentOutOfRangeException 1 Answer

How to slow down GUI 2 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