Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity 5.2 iOS performance issues

Discussion in 'iOS and tvOS' started by Blundig, Sep 9, 2015.

  1. Blundig

    Blundig

    Joined:
    Jan 7, 2014
    Posts:
    18
    I have a 2d game that is nearing completion. I tried upgrading it from Unity 5.1.3p2 to 5.2.0f3 and noticed it was much choppier than before when playing on the device (an iPad 3). So, I made some development builds to see what the profiler had to say...

    First, the build from Unity 5.1:

    Unity5_1_profiler.png

    Things to note:
    1. The game runs comfortably at 60 fps. On the device, it looks very smooth.
    2. Camera Render and Overhead are the most time consuming items across all frames.
      1. Camera Render peaks around 5ms, but is usually less.
      2. Overhead peaks around 6ms, but is usually less.
    Next, the 5.2 build: (Same project and settings)

    Unity5_2_profiler.png

    Notes:
    1. The frame rate is much worse, with lots of spikes that bring it down to 30 fps. It is very choppy on the device.
    2. Camera Render and Overhead are still the most time consuming.
      1. Camera Renderer is about the same as before (if not slightly better).
      2. The spikes in the image are Overhead which hiccups to > 20 ms every 3 frames (exactly).
      3. None of the other items were noticeably worse than before. Also, no single item followed the "every 3 frames" Overhead spikes. There was no obvious smoking gun.
    I haven't dug in too deep, but I did try a few different build settings. None of these made a difference:
    • Switching from IL2CPP back to Mono
    • Turning off the new Vertex Compression (which is on by default).
    I'm just going to stay on 5.1 for now, but I'm curious if anyone else has had a similar problem or thoughts.


     
    drawcode likes this.
  2. RagemodeEntertainment

    RagemodeEntertainment

    Joined:
    Nov 8, 2014
    Posts:
    7
    Same performance issue here. Although I didn't have patience to profile and went straight back to 5.1.3...
     
  3. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    I to have much odd behavior and slow down on 2D 5.2 game.

    I just wish to know if before each release Unity QA conduct any mobile performance tests.
    To me the answer is pretty much NO or really basic low level.
    I guess they need to hire some performance testers (different to standard)

    5.1x Android, FPS was decreased majorly
    5.2x I just hope same thing does not happen to iOS.
     
  4. Blundig

    Blundig

    Joined:
    Jan 7, 2014
    Posts:
    18
    Here's a follow up with more information...
    1. The problem seems confined to my iPad 3. I ran the same tests on an iPad Mini 1st gen, an iPhone 4s, an iPod Touch 5th gen, and an iPhone 6 plus. On those devices, performance was as good or better with 5.2.
    2. Here is a composite image of 2 frames from the profiler Timeline view. It shows a normal frame above a hiccup frame. You can see that after PlayerEndOfFrame, there is a much larger empty gap before Grahics.PresentAndSyc during a hiccup. This pattern repeats itself every 3 frames like clockwork.
    composite.png

    On 5.1 builds, all frames look similar to the normal frame above. The extra large gap just never happens.
     
  5. povilas

    povilas

    Unity Technologies

    Joined:
    Jan 28, 2014
    Posts:
    427
    Could you please submit a bug report and post the bug number here? Thanks
     
  6. Louis-N-D

    Louis-N-D

    Joined:
    Apr 17, 2013
    Posts:
    224
    And, please, come back and post the bug link here if you could. I tried my first iOS build with 5.2 yesterday and got terrible performance on my iPod 5th gen. I lost a full 20 fps on what used to hover around 55-60. It was also not just bad framerate, it was jittery too. Like the framerate was both bad and inconsistent.
     
    MrEsquire likes this.
  7. Blundig

    Blundig

    Joined:
    Jan 7, 2014
    Posts:
    18
    Yes, it is definitely very jittery for me as well (makes my game unplayable). You can see the jitters in the profile pictures where the spikes occur and push the framerate down to 30 from 60.

    I haven't filed a bug report because I didn't have a simple project that could reproduce the issue (and I can't upload my full project for business reasons). However, I spent some time attempting to narrow down the issue and have some new data that I will post shortly...
     
  8. Blundig

    Blundig

    Joined:
    Jan 7, 2014
    Posts:
    18
    Here are my new findings:

    There was definitely a change in 5.2.0f3 regarding how the iOS device syncs with the screen refresh, vs how it worked in 5.1.3.p2.

    I made a test project that switches Application.targetFrameRate between 3 values [60, 30, -1]. I compiled this project with both versions of Unity and profiled them on my iPad 3rd generation. Here are the results:

    Unity 5.1
    Unity-5_1.png

    Notice that the game smoothly stays within its desired frame rate. When asked to run at 60 or 30 fps, it does so. When asked to run as fast as it can (with the value of -1), it behaves the same as at 60. This makes sense, because iOS devices are locked to a max screen refresh of 60 (as far as I know).

    Unity 5.2
    Unity-5_2.png

    Notice the spikes when targeting 60 fps. As mentioned, it is actually worse than just running at 30 fps because it constantly jitters between 60 and 30. Oddly, switching to 30 seems to let it run as fast as it can (> 100 fps). Switching to -1 gave the exact same results as setting to 60.

    A few more points:
    • Spikes don't always happen exactly at every 3 frames like my original posting. It depends on the scene.
    • The spikes don't occur on an empty scene. It needed to have some objects to render (I used 2d sprites).
    • When testing on a 4s, I got different results. The 5.1 build results were identical. For 5.2, it ran at > 120 fps, regardless of the settings. My guess is that if I made a more demanding scene, it would start showing the spikes (the iPad 3 has to draw many more pixels than the 4s). In either case, it shows a change in how drawing to the screen is done under 5.2.
    • Even when the profiler says the game is rendering at > 100 fps, the experience on the device can still feel jittery with the 5.2 build.
    Conclusion:
    Something has gone wrong with iOS rendering on 5.2 ;-) This was demonstrated above by switching Application.targetFrameRate settings, but the underlying problem might be elsewhere. What is known is that scenes that rendered at consistent framerates under 5.1 (across different devices) can behave erratically under 5.2.

    I will post a bug later today and link to it here.
     
    drawcode, mh114, Louis-N-D and 2 others like this.
  9. Blundig

    Blundig

    Joined:
    Jan 7, 2014
    Posts:
    18
  10. Laumania

    Laumania

    Joined:
    Jun 27, 2012
    Posts:
    221
    I haven't looked to much into my problems, but I have a 2D game too, build in NGUI mostly, and I noticed bad performance even on my iPhone 6.

    Please update this thread when a solution is found - apparently you are not alone with this problem.

    I upgraded to Unity3d 5.2.0p1 and the final iOS 9 release at the "same" time...so I actually not sure if it's iOS or Unity that make my game less smooth... but as I see here more have similar problems, I guess it is Unity3d that takes the honor :p
     
    Last edited: Sep 21, 2015
    MrEsquire likes this.
  11. aaefiikmnnnr

    aaefiikmnnnr

    Joined:
    Aug 21, 2014
    Posts:
    12
    We are still using Unity 4.6.8f1, and we encountered similar performance issue while running our game on iOS 9.0.1. The exact same build runs totally fine on iOS 8.4, the frame rate dropped to about a half on iOS 9 and the profiler shows similar spikes on iOS9, 9.0.1 and 9.1 beta. I wonder whether it is actually an iOS9 issue or we got two issues at the same time.
     
  12. Laumania

    Laumania

    Joined:
    Jun 27, 2012
    Posts:
    221
    I'm not sure, but to me it sounds like two bugs at the same time - spice up the mix of difficulties :)

    I upgraded to iOS 9 at the same time as Unity3d 5.2 (totally stupid me I know...) so I don't know what introduced the bug on my phone. But my betatesters are all reporting worse performance in the release I pushed out yesterday, and I haven't changed anything that can impact performance on all scenes in the game.

    At least that how it looks from my side :)
     
    MrEsquire likes this.
  13. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Are you trying any patch releases? - I'm waiting for 4.6.8p3 official, as I know some iOS9 changes in the patches 1 and 2.
     
  14. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Bug reports get things moving quickly, forum reports do not. More than one bug report can raise the priority of an issue, esp with more data (test scenes from different people). You can also link forum threads for more rich data for them.
     
  15. Laumania

    Laumania

    Joined:
    Jun 27, 2012
    Posts:
    221
    Well, I get that, but one bug is already reported and it is linking to this thread, so the dev reading it get here and see multiple people having the issue.
    I know that will not make the bug report look important, before someone reads all the way through it, but I cannot see the bug listed on the issue tracker yet...if it was there, I would upvote it :)

    https://fogbugz.unity3d.com/default.asp?728361_pr79ufas4vfal1dj

    If someone know where the above bug is listed at http://issuetracker.unity3d.com/ please put a like here, so we can upvote it.
     
  16. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I'm just telling you how it is, not negotiating or discussing or anything. It's how it works. It goes first through QA who have to decide if its real or not, long before it gets to a developer. Also, QA might well fix this at the gate, and in any case:

    more reports = more machine/os/unity specs etc - its just more unique data which does very much help. Some bugs are pretty tricky to nail with just one report when there's 22 platforms and so on ;)
     
  17. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Actually, Unity QA should monitor forums and gives these issues top priority..
    If one person posts and finds a killer bug, and 100 find a basic stupid bug with low priority, the one 100 ppl found bug gets fixed. Not how it should be, there needs be a balance... Please lets not go off topic because each time someone finds a critical bug the bug reporting issues come up and debates start..Let people speak in the forums and express there concerns and issues....its there choice if they file bug report or not...maybe if people had more faith in the process then everyone one will report....I'm surprised as a moderator who on forum each day you not realized the problems and issues..
     
  18. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    And you know better, how? This process evolved because monitoring the forums is impractical in reality, and mostly doesn't work, for many, many proven reasons.
     
  19. Laumania

    Laumania

    Joined:
    Jun 27, 2012
    Posts:
    221
    To get back to topic....I tried to set the Vertex Compression to "None" in my game, and it feels like it speeded up my game. I haven't tested with a FPS counter, but it seems to the naked eye that this improved performance.

    I'm on Unity3d 5.2.0p1, testing on iPhone 6 with iOS 9.0.1.
     
  20. Blundig

    Blundig

    Joined:
    Jan 7, 2014
    Posts:
    18
    The specific case I posted definitely isn't related to iOS 9. I verified the behavior under iOS 6, 7, and 8. The test case is also narrowed down so that switching between Unity 5.1 and 5.2 is the only variable. Of course, that doesn't mean there aren't separate issue with iOS 9.
     
    MrEsquire likes this.
  21. aaefiikmnnnr

    aaefiikmnnnr

    Joined:
    Aug 21, 2014
    Posts:
    12
    Hello, I just tried to set Graphics API from "Automatic" to "OpenGL ES 2.0" and the performance improved by a lot. The test is conducted on iPad mini 2 (A1489) with iOS 9.0.1 and the build environment is Unity 4.6.8f1 with Xcode 7.0 (7A220). I agree with Blundig that there might be a separate issue regarding OpenGL ES 3.0 or Metal on iOS9.
     
  22. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Thanks for the information, I try with OpenES2.0 always been most stable.
    I usually use automatic and also using 4.6.8 build due to good stability.
    Do you notice much visual difference in game from Automatic to ES2.0?
     
  23. aaefiikmnnnr

    aaefiikmnnnr

    Joined:
    Aug 21, 2014
    Posts:
    12
    I didn't notice a difference in our game. But our title is a very simple 2D game.
    I am not sure whether it will affect more complex games like 3D titles.
     
  24. GroundCombo

    GroundCombo

    Joined:
    Jan 23, 2015
    Posts:
    29
    Forcing OpenGLES 2 instead of Metal also helped with our project (2D sprite-based). I was seeing the exact same issues as in the first post with 5.2.0p1; switching APIs put the performance back where it was before. Tested on iPad Mini 2 with iOS 9.0.2.
     
  25. Wawro01

    Wawro01

    Joined:
    Apr 23, 2014
    Posts:
    44
    Does somebody know if its fixed in 5.2.1p3 ? Unfortunately from release notes it seems to be that not :(
     
  26. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    They never mention performance issues in release notes, its always trial and error with each patch and build, hence so many threads on issues. Ok sometimes its user projects but not convinced since the 5.2x the bug numbers i the forum posted by users all open! Hence not fixed
     
  27. aleksandras

    aleksandras

    Unity Technologies

    Joined:
    Oct 2, 2015
    Posts:
    2
    We did some research of this performance issue and it seems it's due to a few problems in the new Sprites/Default shader. It will be fixed in 5.3 but for now we have a workaround for it:
    1. Go to https://unity3d.com/get-unity/download/archive and download the builtin resources zip for Unity 5.1.2
    2. Extract the zip and find DefaultResources/Sprites-Default.shader
    3. Rename the file to something else for example SpritesWorkaround.shader, and then open in any text editor and edit first line to reflect this change for example
    Code (csharp):
    1. Shader "SpritesWorkaround"
    2. {
    3.     ///....
    4. Drop it into your unity project and create a new material and select the shader you just added
    5. Use this material for all objects that use the Sprites/Default shader
    6. Rebuild & Test

    The performance problem should be gone
     
    MrEsquire likes this.
  28. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Finally some confirmation that a issue exists.
    Thanks for the workaround and efforts.

    But one problem 5.3 is not out for a long time, why can you not add this to the next 5.2.1 patch or the 5.2.2 release?
     
  29. Alex-Lian

    Alex-Lian

    Guest

    Having just glanced at the bug:

    - The issue got fixed without knowledge of this thread or bug by another developer in 5.3 (trunk)
    - Aleksandr above just investigated it as of yesterday and provided the info today
    - It's now been assigned back to the developer who fixed it in 5.3, and he's in a timezone that we have to wait for him waking up to decide if it's something that can be ported back easily to 5.2.

    So....let's not jump to conclusions that we won't do it. It's that the process is working to get there.
     
  30. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Ok thank you for the clarification..
     
  31. aaronflippo

    aaronflippo

    Joined:
    Jun 7, 2012
    Posts:
    45
    Just to chime in, I'm seeing a similar issue with Unity 5.2 and iOS 9 with Metal. My Camera.Render alternates between 15ms and about 30ms, where it was pretty consistently around 8ms on Unity 5.1. The profiler doesn't really give any details about where the time is being spent - the Sum of Drawing, culling etc. is around 5ms.

    I also don't believe I have any sprites in my scene. It's a 3D game using NGUI.
     
  32. aaronflippo

    aaronflippo

    Joined:
    Jun 7, 2012
    Posts:
    45
    I can also confirm that switching to OpenGLES puts Camera.Render() back into a sane range.
     
  33. fraoula

    fraoula

    Joined:
    Mar 25, 2015
    Posts:
    14
  34. Naxite

    Naxite

    Joined:
    May 24, 2014
    Posts:
    3
    Hey, just double checking, this was not fixed in 5.2.2, correct? We need to wait a little while longer for this?
     
  35. Masterio

    Masterio

    Joined:
    Sep 27, 2013
    Posts:
    8
    5.2.2 slow the same as 5.2.0 and 5.2.1 :(
     
  36. seejay3061

    seejay3061

    Joined:
    Oct 21, 2013
    Posts:
    12
    Is anyone having any luck with the workaround? I changed every material that I could imagine used the Sprites/Default shader but the problem is still the same.
     
  37. pixity71

    pixity71

    Joined:
    Apr 23, 2015
    Posts:
    7
    Same here...OpenGLES errors for (iOS 8 or iOS 9.1 installed) devices or any non-metal capable (32-bit) devices. iOS version doesn't matter. Rolled back to 5.1.4 and the issue went away but then Metal graphics on my iPhone 6s plus was all screwy. Another release...1 step forward 2 steps back. Remind me why I'm paying $225 a month for this BS??
     
    MrEsquire likes this.
  38. aRainyDay

    aRainyDay

    Joined:
    May 24, 2013
    Posts:
    24
    I'm having a similar experience on my iPad 3 iOS 9.1.
    Anyone tested if this is solved in the available beta 5.3.0B4?
     
  39. aRainyDay

    aRainyDay

    Joined:
    May 24, 2013
    Posts:
    24
    Some test results, all done with Unity 5.2.1f1:
    iPad 3 (iOS 9.1) - 40 fps
    iPhone 6 (iOS 9.1) - 60 fps
    iPad mini 2 (iOS 9.0.2) - 40 fps
    iPad mini 3 (iOS 8.1) - 60 fps

    I didn't have any performance problems using 5.1 (as far as I remember). Is it possible to revert to 5.1 from 5.2?
     
  40. fraoula

    fraoula

    Joined:
    Mar 25, 2015
    Posts:
    14

    Yes you can open your project with Unity 5.1. We did that and the performance was better. But in the end, it turned out that the large spike we were seeing was caused by using Metal. So we ended up building in Unity 5.2. OpenGL.
     
  41. aRainyDay

    aRainyDay

    Joined:
    May 24, 2013
    Posts:
    24
    I tried to do that (I think), but didn't get any improvements, but I'm not sure I did it the right way.

    How did you disable metal?
     
  42. fraoula

    fraoula

    Joined:
    Mar 25, 2015
    Posts:
    14
    In player settings, uncheck "Automatic Graphics API" and you'll see the Metal/OpenGLES2 options.
     
  43. aRainyDay

    aRainyDay

    Joined:
    May 24, 2013
    Posts:
    24
    Since I'm having the performance drop on an iPad 3 I don't think metal is the issue here but I disabled it just to be sure. Maybe it's something else. Whats bothering me is that the profiler doesn't help me a lot. When running on the device using the profiler I get the following result. The overhead is huge but the rest should keep just over or below 60 fps.
    Screen Shot 2015-10-30 at 07.08.30.png
     
  44. aRainyDay

    aRainyDay

    Joined:
    May 24, 2013
    Posts:
    24
    Reverted back to 5.1.4f1, no more performance issues on iPad 3 iOS 9.1. I guess I have to stick to that until the 5.2 issues are sorted out.
     
  45. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    I just wish developer will comment on if they are aware of any iOS performance bugs in 5.2, they are busy adding all the new 9.1 features may have some impact on performance and this has been pushed down. But if things are working nicely on 5.1.4, the root of the issue in 5.2 needs to be found.
     
  46. XCO

    XCO

    Joined:
    Nov 17, 2012
    Posts:
    379
    I am not sure if this is where I am suppose to say this:

    BUT in unity 5.2.2 I have found these issues:

    - Editor crashes a lot if there are too many polygons
    - If you re-start the level in play mode the LIGHTS dont come back on
    - Also the MECHANIM animation no longer play "In their place" when unchecking the burn to xy whatever thing!

    UGHHHH damm you 5.2.2 everything was fine in 5.1 arrrrhgggghhhhhhhh :| (Still love UNITY) aaarrrrgghhhhh
     
  47. aRainyDay

    aRainyDay

    Joined:
    May 24, 2013
    Posts:
    24
    Yeah... it's like children. Sometimes they do not behave, but you love them nevertheless. But hopefully, someday they will grow out of bad behavior and poor performance. Go Unity!!! :)
     
  48. aRainyDay

    aRainyDay

    Joined:
    May 24, 2013
    Posts:
    24
    Anyone tested with the new 5.2.2p2 release?
     
  49. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    616
    I've had this EXACT same issue with Unity 5.2 on iPad3. Just happend to find this post while looking at other things... Can't wait to grab 5.3 beta and see if it's fixed.

    -Jeff
     
  50. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    So whats the latest? Has developer ported back?