Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Waz · Jul 28, 2011 at 04:39 AM · bugtextfield

TextField eats all keys as of 3.4.0

This code appears to no longer work:

unity3d.com - GUI.GetNameOfFocusedControl documentation (uses Return key to confirm a text field as alternative to a button)

It seems now that TextField eats all keys (even releasing of Shift and Ctrl, messing up their states).

Any ideas for workarounds? This is making my game unusable every time I show a TextField. Is there some new input method support or something that I can turn off to maybe avoid whatever added this bug?

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

2 Replies

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

Answer by Waz · Jul 28, 2011 at 04:46 AM

I found Input.eatKeyPressOnTextFieldFocus:

 Input.eatKeyPressOnTextFieldFocus = false;

Since TextField doesn't even correctly restore state of CTRL, you basically have to do this if you use Shift or Ctrl state in your game.

Comment
Add comment · Show 6 · 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 Tuor · Aug 03, 2011 at 01:52 PM 0
Share

How do you use it in a script??? In a Awake function, i wrote " Input.eat$$anonymous$$eyPressOnTextFieldFocus = false; ", but i get an error: BCE0019: 'eat$$anonymous$$eyPressOnTextFieldFocus' is not a member of 'UnityEngine.Input'.

avatar image Waz · Aug 03, 2011 at 01:59 PM 0
Share

Yes, just set it once in one object's Awake function. Are you using 3.4.0?

avatar image Tuor · Aug 03, 2011 at 02:19 PM 0
Share

No... 3.3

avatar image Tuor · Aug 03, 2011 at 02:22 PM 0
Share

I just tried in 3.4, and it works fine now.

avatar image zzzzz · Sep 11, 2013 at 12:21 AM 0
Share

This works for Unity 4 but it also gives the following warning...

warning CS0618: UnityEngine.Input.eat$$anonymous$$eyPressOnTextFieldFocus' is obsolete: eat$$anonymous$$eyPressOnTextFieldFocus property is deprecated, and only provided to support legacy behavior.'

Should I be worried???

Show more comments
avatar image
0

Answer by twburger · Mar 20, 2014 at 11:55 PM

More specific to the exact question:

I think you may need Event.Use

void Use(); Description Use this event.

Call this method when you've used an event. The event's type will be set to EventType.Used, causing other GUI elements to ignore it.

  if (Event.current.isKey) {
 
             switch (Event.current.keyCode) {
 
                 case KeyCode.Return:
 
                 case KeyCode.KeypadEnter:
 
                 val = editingValue;
 
                 applying = true;
 
                 Event.current.Use();    // Ignore event I used it
 
                 break;
 
             }
 
         }
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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Android Bug related to drawing TextField after a Box which is only in a Repaint event 0 Answers

TextField text pushed to left on space 1 Answer

Textfield button PLZ HELP!!! 1 Answer

Editable text field in Android with cursor 0 Answers

Popup opened by event. Android 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