- Home /
NGUI buttons stop responding after game loses and regains focus, on Android Galaxy Tab 2
On an Android Galaxy Tab II, when my game is running and then loses focus (by pressing "Home", by pressing the power button to turn off the screen, by switching to another running app in the background, etc.) and then regains focus, NGUI buttons are not responding.
I saw a similar problem that used to happen with EZGUI, here, so I tried replacing all of NGUI's realtimeSinceStartup with Time.time - didn't help.
I also tried implementing OnApplicationFocus that re-enables all colliders, and although the event was run in the Editor, it doesn't help on the tablet.
Any ideas?
Answer by CalebFnord · May 16, 2013 at 11:34 AM
So as not to waste anyone's time, I'll answer myself:
A Unity update caused a bug in several plugins. All plugins' developers issued a patch and eventually a stable version that fixed this.
What was this bug? And in what version(s) was it fixed? Was it fixed in a Unity update, or just in plugin updates?
If I remember correctly, it was a bug that caused Input.touchCount to be reset after the Unity application lost and then regained focus which rendered NGUI buttons unresponsive.
I had a problem with NGUI and 2DToolkit, I believe, and both quickly issued patches that fixed the problem. In 2DT$$anonymous$$, it was around version 1.92.
I don't know if the issue was resolved by Unity or if the patches remain in effect until today.
Thanks, that's exactly what I am seeing. Input.touchCount becomes stuck at zero, and there is nothing you can do about it :'(
At least it sorta made me feel better when I played another Unity game released about 9+ months ago that exhibits the same behavior if you cycle focus enough.
Hopefully when I am in a position to upgrade to the latest Unity 4.2, the trouble will go away.