- Home /
GUI.Button lags on iPhone
I'm testing this on a clean project without anything in it and I'm still getting this strange lag. I have created three buttons like this:
void OnGUI() {
if (GUI.RepeatButton(new Rect(10, 500, 120, 120), @"One"))
goLeft();
if (GUI.RepeatButton(new Rect(Screen.width - 120, 500, 120, 120), @"Three"))
goRight();
if (GUI.Button(new Rect(Screen.width/2 - 60, 500, 120, 120), @"Two"))
TapFunction();
}
The thing is, when I tap on the button, then release the finger and quickly tap on another one, sometimes the button is not quick enough to respond. I have to wait for some milliseconds after releasing the finger so that I can tap on another button. And this drives me absolutely crazy. I'm using Unity 4.0.1, iOS 6 and Xcode 4.5 Any ideas on what it might be? Thanks.
I have never coded for mobile devices but I remember reading, that the OnGUI method is not really suited for mobile devices because it eats too much performance. There wer other questions about this too (i.e. this question)
I'd suggest you use a gui texture and attach a script which uses On$$anonymous$$ouseWhatever. Full list of available functions are listed in the docs
Is this still a preset problem in Unity 4 and up?
Anyone know?