We have been working on a game over the past few months in unity 3.3 Recently we updated to 3.4, and XCode4, to take advantage of the updates to Unity 3.4. Fortunately, the game runs the same as it did before in terms of functionality, so nothing appears to have broken there. Unfortunately, our performance on the iPhone 4 has gone from around 30fps to around 3fps.
When running the profilers, the best result we can come up with is that Device.Present looks a little odd. Here are its stats:
Device.Present
Total: 82.1%
Self: 82.1%
Calls: 1
Memory: 0B
Time ms: 37.94
Self ms: 37.94
Reading through other profilers and reviewing code, everything else looks good. Since we’ve made no code changes - outside of updating the Prime31 plugins we use, SocialNetworking and GameCenter, to their latest versions, we’re rather stumped on what could have broken in the product. We have reviewed things like the Quality and made sure its settings were the same as before. We are willing to bet a property or setting somewhere is new or changed from what we had it set to in 3.3 which is now causing this huge performance drop, we’re just a bit stumped now on where to look.
Any suggestions, recommendations or support we could get on this matter would be wonderful. Thank you in advance!
As it turns out, we hade to modify our shader code. The same shaders that had very little performance impact in 3.3 had massive performance impact on iOS in 3.4. So if you are stuck, check there. Also, in AppController.mm, change this:
#define USE_OPENGLES20_IF_AVAILABLE 1
To this:
#define USE_OPENGLES20_IF_AVAILABLE 0
Which we found also gave us a significant FPS increase (nearly doubled our framerate on iOS).
big thanks to DCalabrese, you saved my work!
BTW, just a little note about Unity4: now AppController doesnt have anymore “define USE_OPENGLES20_IF_AVAILABLE 1” but for fixing the device.present problem you can just change the Graphics Level on Player Settings from OpenGLES 2.0 to OpenGLES 1.0.
Enjoy!
In 5.4 uncheking the "Auto Graphics API " ( in player settings) and deleting GLES3 Gave me back a few FPS
I have noticed that 3.4 adds some pragmas to certain scripts when you upgrade a 3.3 or older project, to avoid unsafe code in javascript.
The only thing I can think off is that you might have developed using ‘unsafe’ (by 3.4’s new standard) variable declaring, and that maybe unity is just trying hard to avoid crashes and such, since your scripts might not be headed with the new required pragmas.
I suggest you dig into the new pragma statemens introduced in 3.4, and deduce if they might be the cause. Hopefully you’d just need add those lines to fix the performance drop.
Another thing you can try:
compare your scripts (pain in the ass, but could be worth it) from a backup of your 3.3 project version, and from a 3.4 fresh import version.