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?