Search Unity

Very poor performance on Android after upgrading to Unity 5

Discussion in 'Android' started by digitalMUTANT, Mar 3, 2015.

  1. frogwise

    frogwise

    Joined:
    Nov 27, 2009
    Posts:
    103
    Super simple scene here. Scrolling background on a plane - that's it. Runs at ~3000 fps in editor, and around 50fps on android. 0.5ms CPU load in Editor, 15ms on Android. Technically, that's not a terrible framerate, but the problem is I will get these profiler "spikes" once in a while, and most of them are from Camera.Render. These spikes shoot the CPU milliseconds from 15 to 85, which cause these little jitters once in a while.

    Furthermore, when I go deeper into the Camera.Render to see what inside it is causing it, the numbers inside don't add up to 85ms. What gives? Camera.Render is showing me 85ms for that frame, i expand it, and all the elements inside there don't nearly add up to 85ms. Where is this "lag" spike coming from??
     
  2. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    577
    Are you hired by unity? You talking on their behalf? I can't see your Unity Staff badge. If you are an official could you elaborate to share info on how the lag issues of u5 are being handled currently?
     
    MrEsquire likes this.
  3. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    I am not working for Unity and not speaking on their behalf. I just don't get it why there is such a lot of useless chit chat and pointless complaining in this thread. Five pages covering different issues and just one bug report?! "Pointless complaining about any Android performance issue, not necessarily introduced with Unity 5 and not necessarily a Unity issue - let it all out!" would be a better title for this thread.
     
  4. mrm83

    mrm83

    Joined:
    Nov 29, 2014
    Posts:
    345
    i don't know if this is a unity 5 issue, but i just upgraded from 4.6 to 5.01 and created a very simple game and when i run it on android it heats up very quickly..
     
    MrEsquire likes this.
  5. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    350
    Probably because of the new Unity 5 lighting stuff? Did you turn Global Illumination and so on off?
     
  6. mrm83

    mrm83

    Joined:
    Nov 29, 2014
    Posts:
    345
    No.. where do i turn it on off? i don't see it
     
  7. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    350
    Window -> Lighting - There you can un-check Precomputed Realtime GI and Baked GI and so on
     
    MrEsquire likes this.
  8. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    The problem would be solved if there is official answer from Unity devs...So it does not bother me personally if people are complaining they have the right to..Im sure they stop the complaints after official word. If you want a example of a perfect thread then read this http://forum.unity3d.com/threads/4-6-ios-64-bit-beta.290551/page-36
    Excellent team work with community and Unity developer..!
     
  9. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    It usually helps to keep the noise level in threads as low as possible that developers become active and stay in the discussion. This is definitely not the case here. It is still not clear what the actual causes of the slow downs are. It is clear that there is not just one potential cause. There are many random people jumping into the discussion just to post once, hey I also have performance issues on Android. It is not necessarily a regression, but it may even be in a new project. If I would experience a performance issue in Android that didn't exist in Unity 4.x, I would definitely not post it here, because of the huge amount of useless information.
     
  10. gtzpower

    gtzpower

    Joined:
    Jan 23, 2011
    Posts:
    318
    It seems that there is an open issue about slow loading of resources. I am assuming that this is related to the Loading.LoadFileHeaders issue:

    http://issuetracker.unity3d.com/iss...source-folder-with-android-player-is-too-slow

    That being said, the solution for me was very simple and I feel a bit like a fool for not having it this way in the first place. I was loading a lot of game objects by calling:
    Code (CSharp):
    1. GameObject go = Instantiate(Resources.Load("MyPrefab", typeof(GameObject)), new Vector3(0, 0, 1), Quaternion.identity) as GameObject;
    2.        
    which called Resources.Load repeatedly on an unchanged resource. Now, I load the resource once in Start() and then instance it like follows:
    Code (CSharp):
    1. Object prefabResource = null;
    2.  
    3. void Start()
    4. {
    5.     prefabResource = Resources.Load("MyPrefab", typeof(GameObject));
    6. }
    7.  
    8. void Update()
    9. {
    10.     GameObject go = Instantiate(prefabResource, new Vector3(0, 0, 1), Quaternion.identity) as GameObject;
    11. }            
    My project is running much smoother now on Android. Sucks that I have to change it from how it worked in Unity 4.6, but the end result is better programming anyway :)
     
    TomBayley1 and pixpusher2 like this.
  11. bart_the_13th

    bart_the_13th

    Joined:
    Jan 16, 2012
    Posts:
    498
    Well, I just found it funny(not really though)

    I have two games made using Unity 4.5 and upgrade them to Unity 5, and guess what? They're just running fine, even after I add a post process water effect to the 1st game(it's actually still WIP).
    The second game(already released using Unity4) even has rigidbodies, navmesh etc stuffed into it and I even added render2texture scope into it and it still running just fine(maybe 10%-20% fps loss) but it still running 40-50 fps on my galaxy S2. Note that the Unity4 version framerate is not far from 50 - 60 fps...

    But, when I create new game using Unity5, the fps drop to 5, maybe 10 max, even if there are only two 6k polied animated models plus one <2000 poly static(unanimated) mesh. Still need to test if removing the animator and using the ol'reliable Animation will help(kind of doubt it though)
     
    Gekigengar likes this.
  12. Deleted User

    Deleted User

    Guest

    We just upgraded 4.6.5 to 5.0.2, same problem -- our Android performance dropped from 50 to 12 fps, a 75% drop. This is a AAA game, most shaders are mobile diffuse or mobile bumped diffuse. One directional shadow. We do not use skybox; do not use the new standard shader (unless the automatic upgrade somehow inserted it into project?); our VSync is Every VBlank.

    Bug is submitted, (Case 696987) Unity 5.0.2 Android performance: FPS dropped by 75% after upgrading from 4.6.5

    A couple things make me suspect this is related to shadows or lighting, but that is a hunch, not proven. Reasons for the suspicion:
    - Changing QualitySetting from Beautiful <> Simple has a huge effect on FPS with 5.0.2. Beautiful is 12 fps, Simple is 45 fps. This is very different from 4.6.5 where all three quality settings run close to 50 fps. Changing these settings changes pixel light count between 1-3 and shadows from hard-only 1 cascade to hard & soft, 2 cascades (though I think the soft option has no effect on mobile -- if 5.0.2 now does soft shadows that could be the difference)
    - Turning off the lights in scene restores FPS to 55+

    Other than the Android performance issue the upgrade went very smoothly, so Unity folks if you can fix this we would love to stay on Unity 5!

    ---
    UPDATE

    I made a static scene with no scripting and no characters, just our level map which is shading and geometry intensive. Performance was roughly the same on Unity 5.0.2 and 4.6.5. So I don't think the issue is geometry pipeline or mobile shaders directly.

    Some posts suggested the problem is the new 4.6 Canvas, which we use in our app. However I ran a test where we toggle our Canvas on/off and it made no difference to fps, so I don't think that is the issue.

    I'm going to try to isolate some of the things QualitySetting was changing to see which parameter seems to be causing the big fps drop

    ---
    UPDATE 2

    OK that test was definitive, the performance drop is due to shadows.

    I made two new QualitySettings with the only difference the shadow settings:

    50 FPS with both Unity 4.6.5 and 5.0.2:
    Hard Shadows Only
    Low Resolution
    Shadow Distance 40
    No Cascades

    12 FPS with 5.0.2, 50 FPS with 4.6.5:
    Hard and Soft Shadows
    High Resolution
    Shadow Distance 70
    Two Cascades

    I'm not convinced that turning on soft shadows actually did anything with Unity 4 on Android. Perhaps the problem is just that Unity 5 added mobile support for soft shadows and forgot to warn us that it would slow rendering down if enabled by the quality settings?

    --- UPDATE 3

    Some final details:
    - setting Two Cascades (instead of zero) on Android always cuts our FPS by 75%
    - setting Hard and Soft Shadows (instead of just Hard) is intermittent; sometimes it does not impact performance, sometimes it causes a 20-30% slowdown
    - ditto for Shadow Resolution; sometimes High affects performance, sometimes not

    The only certain conclusion we have is Two Cascades is a performance killer with Unity 5 on Android. The other behavior is hard to interpret (a lot of complex factors can can affect mobile performance, e.g. CPU speed may change if it overheats)

    btw we have also seen some unreliability launching our Android app when built with Unity 5; the frame buffer is corrupted on launch and although the game runs it never fully repairs (very retro, I haven't seen a snow crash in a long time). Happens about 10% of the time on Samsung S4.

    I'm leaning to waiting for Unity 5.1 at the moment
     
    Last edited by a moderator: May 15, 2015
    Shredov, bennyboy, milox777 and 2 others like this.
  13. bart_the_13th

    bart_the_13th

    Joined:
    Jan 16, 2012
    Posts:
    498
    Yup, I can confirm that a project upgraded from Unity 4.5 to 5.0 would run better than creating it from scratch.
    I just re-created another project in Unity 4.5, and upgrade it 5.0 and it run almost as fast as before upgrade. Maybe because the lack of canvas in Unity 4.5 so the canvas in Unity 5 is automatically disabled.
    I havent tried Unity 4.6 so I cant say much about it ;)
     
    MrEsquire likes this.
  14. NatMonney

    NatMonney

    Joined:
    Dec 8, 2014
    Posts:
    4
    Hey there, don't know if it can help, but I also had a huge FPS drop with Unity 5, with Android devices.

    Fortunately, I managed to get the performances back by switching the Rendering Path (in Android Player Settings) back to Legacy Vertex Lit (I'm using unlit shaders for a 2D game btw).

    "Force Open GL ES 3.0" was also really bad for the performances with Android and Unity 5, I would recommend to keep the 2.0

    Hope it can help !
     
    larku likes this.
  15. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    Don't use the Standard Shader on Android, switch back to the legacy mobile shaders.
     
  16. Friction

    Friction

    Joined:
    Jan 6, 2015
    Posts:
    18
    I build without skybox,
    I build without UI Canvas,
    I build with Legacy Vertex Lit (Rendering Path),
    I build with Legacy Shaders/Diffuse,
    I build with only terrain and three cubes...
    These are not working on my project.
    I am getting 60 fps with Unity 4.6.5 and 12-16 fps with Unity 5.0.1f1 & Unity 5.0.2f1.
     
    emergki likes this.
  17. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    This is why each week one waits for 4.6x releases and patches :)
    Although one misses out some of the newer features of Unity 5.
    Another week, still no official reply from Unity on issue
     
  18. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Sounds like a good reproduction. Did you submit a bug report? If you did, you should post the case number here in the case someone from Unity sees it here in the thread.
     
    milox777 and Meltdown like this.
  19. Friction

    Friction

    Joined:
    Jan 6, 2015
    Posts:
    18
    Yes, I send with my project folder and .apk file.
    Case number: 698578
     
    milox777 and Dantus like this.
  20. mzg

    mzg

    Joined:
    Mar 26, 2014
    Posts:
    7
    Any updates?
     
  21. henkjan-baard

    henkjan-baard

    Joined:
    May 26, 2015
    Posts:
    3
  22. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
  23. Friction

    Friction

    Joined:
    Jan 6, 2015
    Posts:
    18
    Any updates? We want to release our game but still waiting for your answer.
     
  24. MadJezus

    MadJezus

    Joined:
    May 19, 2015
    Posts:
    1
    Hey Unity guys, the same problem. Simple 2d game without special effects - fps drops to 30% compare to 4.6. I've tried all stuff that people posted, but no result. It's kinda shame cuz I'm gonna to rollback to the previous engine version.

    Please don't break my absolute love with unity
     
    Last edited: May 27, 2015
    Gekigengar and MrEsquire like this.
  25. henkjan-baard

    henkjan-baard

    Joined:
    May 26, 2015
    Posts:
    3
    If I understand correctly is the fps drop something that happens when bringing your project from Unity 4.6 to Unity 5?
    In other words the performance should be better when buidling your project in Unity 5 from scratch?
     
  26. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    I doubt anyone has verified this by rebuilding an existing project in Unity 5 from scratch - in most cases that would be a significant amount of work (unless the project was trivial).
     
  27. emergki

    emergki

    Joined:
    Oct 15, 2007
    Posts:
    422
    I already tried to create a new project from scratch and, the same, 60-70 fps before and now in Unity5 the fps is 13-18. Very disapointed with new Unity5.
     
    henkjan-baard and MrEsquire like this.
  28. henkjan-baard

    henkjan-baard

    Joined:
    May 26, 2015
    Posts:
    3
    What I don't understand is why there aren't more posts on this forum! Are there not many people developing for Android (or iOS)?
     
    Friction likes this.
  29. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    The case is still in QA, but I had a short look.

    There is only a project for Unity 5 attached. It would be very helpful to have a Unity 4.6 version to compare with.
    And please always add information about which devices you used for testing, otherwise this will probably get filtered by QA.

    I ran the project (built with Unity 5.0.2p3, development build) on Nexus 5 (Android 5.1) and Samsung Galaxy S (I9000, Android 2.3.3). I'm getting about 45fps on the Nexus 5. When I change the Camera's Rendering Path in the first scene from 'Legacy Deferred' to 'Vertex Lit' I'm getting 60fps on the Nexus 5, about 55fps on the SGS1.
    Because of the case description I'm assuming that you didn't intend to use 'Legacy Deferred', so I cannot reproduce the extreme performance drop.
     
  30. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    Do you still have both projects? I would like to have a look.

    If anyone else has a simple project that performs significantly worse in Unity 5.0 compared to Unity 4.6, please file a bug report with both versions and post the case number here.
     
  31. CastleIsGreat

    CastleIsGreat

    Joined:
    Nov 10, 2014
    Posts:
    176
    I'm getting reports of bad performance on the THL 5000 our game Tunnel Fish runs fine on other devices so far the THL is the only bad report. It seems to be specific to that phone's processor/chip set. Not sure how to improve performance on it. The chip the THL uses is the MediaTek 6592, while ive got a report from the same reviewer of using an Xperia C3 which has a Qualcomm chip, running the game almost flawlessly despite being a much older and slower device. Does anyone here with a MediaTek chip mind downloading and reporting in on this?

    https://play.google.com/store/apps/details?id=com.NaniteGamingStudio.TunnelFish
     
  32. bennyboy

    bennyboy

    Joined:
    May 5, 2015
    Posts:
    13
    In my experience, turning off the Skybox helped a lot. So did going to simple Legacy, Mobile or self-designed shaders, instead of using complex regular materials.

    The other thing was to keep texture sizes down as much as possible, in my case 512x512 or smaller.

    I've never used versions pre-5.0, but I definitely get the feeling that the new standard materials are too heavy for Mobile games.
     
  33. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    Yes, we are working on optimizations for the Standard Shader on low/mid-end mobiles.
    So if you are targeting devices with OpenGL ES 2 GPUs like Adreno2xx, PowerVR SGX, Mali4xx, Tegra 3 then the Standard Shader and the procedural Skybox in Unity 5.0 is probably too expensive, especially when you render at native resolution.
     
  34. CastleIsGreat

    CastleIsGreat

    Joined:
    Nov 10, 2014
    Posts:
    176
    Interesting, however the sky box is turned off already. I've just gone ahead and disabled the device, It doesnt seem to be an overly popular device, and its the only poor report i've gotten so far.
     
    MrEsquire likes this.
  35. PerfectlyInsane

    PerfectlyInsane

    Joined:
    Aug 9, 2013
    Posts:
    74
    I tried it it was pretty awful.. went from average of 38 FPS down to 22 on nexus 7 2013. Tried the Vsync stuff but made no difference.

    Even the gravity went weird at the start like as if was in slowmo.
     
  36. henkjan

    henkjan

    Joined:
    Aug 1, 2013
    Posts:
    146
    We have decided to go back to Unity 4 because the performing on all our Android test devices is not acceptable :(
    It's a shame this is necessary.
     
  37. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
  38. jtsmith1287

    jtsmith1287

    Joined:
    Aug 3, 2014
    Posts:
    787
    I just tried all the optimization tricks on here like the GI tweaks and skybox stuff. Nuthin'... So ya this super sucks. My users are telling me now that some people have our game for testing that performance is pretty terrible, and we're really mindful of how we handle resources and GC and all that. The game runs beautifully in the editor but as soon as it hits a device (Nexus 6, 7 (2nd gen), 10 and Moto X(2nd gen)) performance goes to crap. None of these are low end devices and are in fact some of the more powerful devices, save the 10, cause it just sucks... I only use it to test tablet screen scaling, haha.
     
    CyberScopes, kriket and MrEsquire like this.
  39. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    But did you read the whole thread? Seems like your ignoring some comments here that are not related to shaders and skyboxes, maybe you not allowed to say everything...but if your a developer, maybe your should really start bugging QA, right now do not feel like submit more bug reports is even needed...the picture is clear!!! Android performance gone to crap and I want to know - like many others , what is being done about it?
     
  40. jpthek9

    jpthek9

    Joined:
    Nov 28, 2013
    Posts:
    944
    Mobile performance (not just Android) is a huge issue with Unity 5. In a brand new project with a primitive cube added in, these are the stats for my iPhone 4:


    There are no scripts at all - just Unity chugging along and draining resources in a completely unmoving scene.
     
    Last edited: Jun 6, 2015
    MrEsquire likes this.
  41. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    It is known that the performance of the procedural sky is very bad. If you used the default scene, this one was included and the performance is not a big surprise in that case.
    As far as I know, Unity is working on performance improvements for the standard shader for mobiles. I hope we see some steps forward there.
     
    jpthek9 likes this.
  42. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    @MrEsquire, it's hard to reply to the whole thread. It's about all sorts of different problems.

    I agree that when reading this thread it's obvious that there are still performance problems. It's very likely that there isn't just a single root cause. So I would expect that people would have simple repro cases for at least some of these performance bugs, but we have only seen very few. It would help at least to narrow down the issues.

    Afaik we didn't look into the problems with Resources.Load yet. It definitely sounds like a serious issue but it shouldn't cause general low frame rate.
     
  43. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    I made some tests too on Android and unity5.

    A scene with on cube as static, new skybox, Precomputed GI and one Directional light as realtime.

    Deffered+forward = 33 fps.
    VertexLit = 42 fps.

    After Removing the new skybox I get 60 fps on all rendering paths.

    The test phone is an XperiaS with Adreno 220.

    So my cocclusion is that the new skybox is eating most of the resources.
     
  44. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,822
    I'm running on 2 different OpenGL ES 3.0 devices and the standard shader is still unusable.
     
    MrEsquire likes this.
  45. jpthek9

    jpthek9

    Joined:
    Nov 28, 2013
    Posts:
    944
    My phone's a pretty old one, iPhone 4, but I figure it's a good testing device because a lot of people still have iPhone 4's and if it runs on that, it should run well on all other relevant devices.

    Anyways, with only quads for meshes, a bit of UI, no skybox, baked lighting, and only mobile shaders, and nothing moving, I get about 10 FPS.
     
    jtsmith1287, MrEsquire and kriket like this.
  46. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,367
    That is a pretty bad performance ...
     
  47. kriket

    kriket

    Joined:
    Aug 28, 2014
    Posts:
    33
    I am targetting iphone 4 and equivalent android devices for my new game and would have to stick with unity4. They said unity5 is faster, better, slicker ..... but until they improve for mobiles, and not just shaders but everything posted here, unity 5 is just not production-ready.
     
  48. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Well said..5.1 tommorow, lets see if anything has changed, all we can do is hope.
     
    henkjan, jpthek9 and kriket like this.
  49. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    577
    Yeah... lets hope, i wonder how that happens that they break everything and then pretend they "don't understand the issue", like im going to teach you - you go into vcs and you look through all of your commits one by one and the one on which performance goes down the drain is the problematic one. GGWP EZ
     
  50. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    577
    so this is the reason why this takes so long? So just that people have the problem is not enough for you, you have to basically deliberately ignore the issue, because someone in QA just decided to do so?
     
    MrEsquire likes this.