- Home /
GUI crashes in Android 4.1
I have an app that works fine on all devices with development build enabled. However, with development build turned off it crashes on some Android 4.1 devices. I was able to track the crashing line in my project, but it's just a simple code creating GUI.Button. If I comment it, app crashes on the next call to GUI.Button or GUI.Box. I was expecting it could be issue with GUIStyle, but even this line:
GUI.Box(new Rect(0, Screen.height - 250, Screen.width, 250), "");
will crash my app. I've struggled with this for days, but I still have no idea why this happens.
Additional info: I have 3 scenes in this app and can move from any of them to any of the other 2. App starts on scene 1, sometimes crashes, sometimes no. Getting to scene2 always crashes, getting to scene3 doesn't crash. However switching fom scene3 to any of the other 2 will always crash. With Debug.Log I was able to detect that the crash always happens in the 4th run of OnGUI in the scene. First 3 runs go without problems, 4th can crash. I upgraded from Unity 4.1.3 to 4.2.1, but it didn't change anything. Neither did disabling the rotation.
Tested on Samsung Galaxy Note and Samsung Galaxy S3.