- Home /
Android Bug related to drawing TextField after a Box which is only in a Repaint event
OK, so this is going to sound strange, and i still don't understand it, but I've found the most illogical bug in Unity 3.5.7 and earlier OnGUI, on Android only
string text = "";
void OnGUI()
{
if( Event.current.type == EventType.Repaint )
{
GUI.Box(new Rect(0,0,200,50), "box text");
}
text = GUI.TextField(new Rect(0,80,200,50), text);
}
Put this on a new script attached to any object in a new scene. The bug is super strange: the TextField doesn't work properly. It pops up the keyboard, but typing only puts input into the box attached to the keyboard and not the Unity TextField object. Removing the Event type check from around the GUI.Box ( which seems totally unrelated and makes no sense at all to me ) fixes this. I'm also going to report this as a bug, but it's important that people know about this in case anyone else has encountered it.
Just so there's a question involved here, I would love to know why the Repaint check around a Box ( and i've test it's only a box, and not a GUI.DrawTexture?!? ) would cause the TextField to fail.