Hey guys
I’m trying to use GUI.TextField in Unity3D on Android. The game is running in landscape. When I click on the GUI.TextField, small Android TextView appears on the bottom of the screen and then Android goes to the full screen editor.
The problem is that when a user taps on the screen when this small TV in visible, it losts focus and the full screen editor never shows up. Moreover the UI seems to be locked up and the user is unable to do anything until he presses hardware back button.
I’m using Unity Pro 3.5 with Android Basic plugin. The problem happens only on Android devices. I’m using Galaxy Nexus with Android 4.1.
My question is, how can I prevent this weird problem from happening? Maybe it will be or already has been fixed in a never version of Unity?
its hard to say without seeing your code, are you telling the keyboard to close at any time?
Good point, here’s the code:
private static void drawFeedback() {
float BUTTHEIGHT = DPI * 0.2f;
Rect window, send;
GUI.Box(window = new Rect(Screen.width * 0.25f, MARGIN, Screen.width * 0.5f, Screen.height - 2 * MARGIN), "Feedback");
if (GUI.Button(send = new Rect(window.xMin + MARGIN, window.yMax - BUTTHEIGHT - MARGIN, window.width / 2.0f - MARGIN * 3.0f / 2.0f, BUTTHEIGHT), "Send")) {
SendFeedback(feedback);
feedback = "";
state = LibState.Running;
Pause(false);
}
if (GUI.Button(new Rect(window.xMax - send.width - MARGIN, send.yMin, send.width, BUTTHEIGHT), "Cancel")) {
feedback = "";
state = LibState.Running;
Pause(false);
}
feedback = GUI.TextArea(new Rect(window.xMin + MARGIN, window.yMin + BAR_HEIGHT, window.width - 2 * MARGIN, window.height - 2 * MARGIN - BAR_HEIGHT - BUTTHEIGHT), feedback);
}
void OnGUI(){
if(state==LibState.Feedback){
drawFeedback();
}
}
I don’t do anything except this code. I don’t access a keyboard, intercept events, handle any other input and so on. I don’t use any Android native code, like the mentioned TextView, so I think it’s a conflict between Unity3D UI and Android full screen text editor. The window is drawn on top of the game, but the game itself uses only two analog sticks, so it cannot mess with the keyboard.