Search Unity

Horrible performance on Android compared to iOS

Discussion in 'General Graphics' started by o1o101, Nov 15, 2016.

  1. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    Hey guys, we are having some serious issues regarding performance on Android compared to iOS.
    I really hope some others are having similar issues so we can figure some things out!

    On a iPhone 6, the game can run on full texture res, real time shadows, bloom effect, and Amplify color, and maintain an amazing FPS, it even runs better on a iPhone 5c than a Samsung S6.

    On a Samsung Galaxy S6 (much better specs) half res textures, no shadows, no effects, the game can maintain 30 fps for about 5 minutes, and then after that it just runs very bad, and also gets VERY hot.

    Some stats, without shadows, etc.

    - 30-60 drawcalls/batches
    - 25-50k verts
    - 50k game objects in the scene according to the profiler (mainly because we have lots of trees) could this cause a performance issue?
    - Lots of textures ( but I doubt it is a memory issue as the S6 has 3gb of ram and the iPhone 6 only has 1)
    - Mainly using the standard shader, tried with legacy diffuse but did not see much improvement.

    Things we have already tried, which helped a bit, but not enough!

    - Unchecked 32 bit display in player settings
    - Disabled open gles 3.0
    - experimented with V sync on and off
    - Disabling all the trees, helped a bit of course, but not significantly
    - Using legacy shaders on our custom shaders, mesh terrain, water, etc.
    - Enabling and disabling occlusion culling, it was hard to tell the difference

    Is there anything obvious that could be killing performance on older devices? With pretty low drawcalls and verts I expected the game to run great!

    Any idea what could be happening, and why it is so bad compared to iOS?

    Thanks!
     
    LevelVV and JamesArndt like this.
  2. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    642
    I've seen similar performance issues, but I'm not sure if it's a Unity issue or an 'iOS devices are just a lot faster' issue.

    Thermal throttling on Android seems a real problem. You get full speed for a few minutes, then the device gets hot and slows down significantly, whereas iOS devices manage to maintain a consistent level of performance. And iOS also has the advantage of Metal these days (but even with GLES, draw calls seem less of a problem on iOS than Android, at least on recent devices). But your draw call count is low already.

    One thing to be aware of is that some Android phones (e.g. Galaxy S6+) have very high-res screens, so you're rendering a lot more pixels than on an iPhone - 2560x1440 is higher than a retina iPad. It may be worth trying a reduced render resolution?

    Last time I tried it, occlusion culling was very CPU intensive, and was ineffective on mobile scenes that are generally smaller and optimised for low draw calls (lots of meshes welded together, few materials), as it can only cull on a per-object basis.
     
  3. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    Hey, happy to see other people interested in this!
    Yea, the thermal throttling on Android is extremely bad, and you are very right about iOS having the advantage with metal, I guess it will help a bit once more Androids get Vulcan and Unity fully supports it.
    I have a menu option for reducing screen res, which helps a TON on the S6, I multiply it by .5 and it gains around 15FPS.

    I could try experimenting with occlusion culling again and see if I get any FPS increase.

    I just have no idea what is causing such bad performance, as a couple years ago, I had a game that was 100k verts/ 100k drawcalls, and it ran 30FPS on a S3!

    Maybe by default I will run the game at maybe .7 res or something.
     
    direwar likes this.
  4. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,876
    S6 screen resolution is 1440 x 2560 and 5c is 640 x 1136 . You should use same resolution on both phones.
    I made about 30 3d game for Android and all the games (Racing,FPS,Simulation and ...) is run at 30 frames per second on lenovo A3300 with Amplify Color.
    Of course before unity 5.4 i had a lots of performance issues ,but after the release of Unity 5.4.1 ,i don't have any problem.
    Do not forget that unity 5 SetResolution doesn't work properly!!! you need to reload the scene after changing resolution!!!!

    My last game is run 30fps+ in 720P resolution on lenovo A3500 with Mali 400 mp2 gpu.
     
    Last edited: Nov 16, 2016
  5. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,876
    My solution to change screen resolution correctly in Unity 5:
    Code (CSharp):
    1.         if(SecPlayerPrefs.SecurePlayerPrefs.GetInt ("Resolution")==3)
    2.         {
    3.             Screen.SetResolution(1280,720,true);
    4.             cam.aspect  = 16f/9f;
    5.         }
    6.  
    7.  
    8.         if(SecPlayerPrefs.SecurePlayerPrefs.GetInt("Loaded")!=3)
    9.         {
    10.             Application.LoadLevel(Application.loadedLevelName);
    11.             SecPlayerPrefs.SecurePlayerPrefs.SetInt("Loaded",3);
    12.         }
    13.         else
    14.             SecPlayerPrefs.SecurePlayerPrefs.SetInt("Loaded",7);
     
    JamesArndt likes this.
  6. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    @aliyeredon2 Thanks again for all the tips! We do this by default on all android phones, we sample the resolution and multiply it by .7 or .5 to maintain proper aspect ratio.
    Now I am very curious about how you say you had performance issues before Unity 5.4?
    We had to downgrade to 5.3.6 because in 5.4 using the "split application binary" feature, is broken, and causes load times to be about 15x longer.
    What has improved in 5.4 for you? What are worse prior to 5.4?
    We are not using IL2CPP because it generates errors, I wonder how much could this be effecting the framerate.

    Thanks for all the good tips!
     
  7. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,876
    I'm not used IL2CPP too.
    I used Unity 4 before 5.4.1. After i used 5.4.1, I think problems are fixed. For example after 5.1.5 unity fog has a big frame rate problem on android.
    Another reason to use 5.4.1 was lightmapping problems.

    I've tested fog again. you can see results:
    (I'm going to test lightmaps on 5.1.5 again. If it worked, I'm going switch back to 5.1.5) fogTest.jpg
     
  8. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    @aliyeredon2 This is very interesting, I would really like a stable version of Unity to use on Android, who knows why the game is lagging! We use fog, and this is some very good tests you did... hopefully the Unity team is aware of this!
    The thing is with downgrading is we fix some issues, but then just run into more issues we didn't have before! I would LOVE a stable version of Unity! I know they work very hard but it seems after each bug fixes the problem just comes back again.
     
    UnityLighting likes this.
  9. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    642
    Don't use the standard fog on mobile. AFAIK it is implemented per-pixel, which is unnecessarily expensive on mobile GPUs

    For most real-world cases, per-vertex fog calculations are good enough, requiring just one extra pixel shader instruction to lerp towards the fog colour.

    (Really, to get decent performance on mobile, you should be writing your own shaders, and avoiding the standard Unity shaders in most cases)
     
  10. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    639
    @bluescrn
    Thanks for the info, unfortunately I have no idea about shaders, so that won't be happening!
    Pretty confused about the fog, I am not sure what would be a good solution.
     
  11. Autarkis

    Autarkis

    Joined:
    Oct 10, 2011
    Posts:
    318
    Yes fog is a complete pain on Android . Such a slowdown. There's a fog asset that runs much better on mobile on the asset store by the dynamic fog creator. ( Extra 10/20 fps on really low end devices)
     
  12. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,790
    I don't think that's true (at the very least it's not true on iOS)
     
  13. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    642
  14. piyush1011

    piyush1011

    Joined:
    Nov 23, 2016
    Posts:
    10
    hello all of you
     
  15. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,790
    bluescrn likes this.
  16. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,876
    And we want to know why fps is different between unity 5.1.5 and 5.2+? What has changed?
     
  17. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,790
    I don't know that, but I think your findings are worth a bug report, Unity should look into it.
     
  18. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,876
    I don't have free time to report this bug.I've found this problem 7 months ago.Anyone who wants , can report this to Unity team.
    Thank you for your report !!!
     
  19. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,790
    Literally just attach the scene you used up there for the test, note that there's a performance regression and also link to your post on this thread. Not much time needed.
     
    theANMATOR2b likes this.
  20. LevelVV

    LevelVV

    Joined:
    Dec 8, 2016
    Posts:
    1
    Hey there deverolirc!

    I was curious if you happened to discover the source of the performance issues you were seeing between Android and iOs.

    Our team has suffered a roughly 10-15 frame drop on our Android devices which is frustrating. We did similar things as you: removal of OC, Vsync, using gles 2.0.

    I was curious to know if you had any luck in finding the culprit! We're beginning our deep dive into profiling now to solve these issues.

    Also, big thanks to aliyeredon2. All of your posts are informative and helpful on the forums.

    EDIT: Also want to say that we gave the fog solutions above a shot only to a 1-3 frame gain.

    The following is a link of the example scene: https://www.dropbox.com/s/xifcsg7nucefpu5/city_perfExample.unitypackage?dl=0
     
    Last edited: Dec 8, 2016
    UnityLighting likes this.
  21. OmarVector

    OmarVector

    Joined:
    Apr 18, 2018
    Posts:
    130
    I was talking with support, and they told me to set blitting type to never at resoultion settings , and it run up to 60 fps once again. try that
     
    sergioabril likes this.
  22. sergioabril

    sergioabril

    Joined:
    Jan 11, 2016
    Posts:
    33
    I can confirm this works. Android builds now runs at 60fps.