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 JoeStrout · Aug 08, 2012 at 10:32 PM · guiioskeyboardtextfieldfocus

TextField not getting focus on iOS

I've got a little dialog with a GUI.TextField for entering your name when you get a high score. It works fine in the simulator, but on an iPad, it does not work reliably -- the field does not get the focus, no keyboard appears, and you have no way to enter text.

If you let it sit there long enough (like 5 minutes or more), then eventually the field does get the focus, and the keyboard appears.

I'm using the iCadeBinding plug-in, which might have something to do with it, but I disable that while the high score dialog is present. I also tried commenting out the line that enables multitouch input, to no effect. I've also tried explicitly giving focus to the text field (using SetNextControlName/FocusControl), but again, this makes no difference.

Here's the revelant code from OnGUI:

GUI.BeginGroup (new Rect(Screen.width / 2 - kWidth/2, Screen.height / 2 - kHeight/2, kWidth, kHeight));

GUI.Box(new Rect(0,0,kWidth,kHeight), "High Score!"); GUI.Label(new Rect(40,70, kWidth-80,50), "Enter your name:"); GUI.SetNextControlName ("NameField"); playerName = GUI.TextField(new Rect(40,120, kWidth-80,50), playerName); if (GUI.Button(new Rect(kWidth/2-60,kHeight-60,120,50), "OK")) { HighScores.AddHighScore(playerName, GUIManager.Score()); StateManager.SetState(StateManager.kStateHighScoreList); }

// End the group we started above. This is very important to remember! GUI.EndGroup ();

// Make sure the name field has the focus GUI.FocusControl("NameField");

Has anybody seen anything like this? Any idea why my TextField would need five minutes to warm up and present the keyboard?

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
0

Answer by JoeStrout · Aug 25, 2012 at 04:26 PM

OK, I've figured it out... it boils down to this problem in iOS: when you have a Bluetooth keyboard connected (which the iCade pretends to be), it is very hard to make the onscreen keyboard ever appear. The reason waiting five minutes would cause the keyboard to finally appear is that in that time, the iCade turns itself off.

Apparently it is possible, though; so I'm currently downloading the latest version of Unity (3.5.5) to try the new TouchScreenKeyboard class. Perhaps with that I can force the soft keyboard to appear despite having an iCade (or other BT keyboard) connected.

EDIT: Nope, TouchScreenKeyboard doesn't work any better than GUI.TextField. With a BT keyboard (such as iCade) attached, no onscreen keyboard appears. So, I guess we'll just have to roll our own. :(

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

Prevent IOS keyboard from showing 0 Answers

Textfield on Android problem 2 Answers

Can I do this? 1 Answer

Using GUI.FocusControl on TextField selects all text 4 Answers

TouchScreenKeyboard flickers 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