Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Very poor performance on Android after upgrading to Unity 5

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

  1. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Its time for you to try it:)
     
  2. Jonny-Roy

    Jonny-Roy

    Joined:
    May 29, 2013
    Posts:
    666
    Hint, if you are using the Standard Shader and seeing slower performance than Unity 4...there is your answer.
     
    Dantus likes this.
  3. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    622
    I am always using the standard shader and I compare the speed of 5.1.4 with 5.2 or 5.3.
     
  4. Jonny-Roy

    Jonny-Roy

    Joined:
    May 29, 2013
    Posts:
    666
    Ah, that makes sense, but then that would suggest you issue is something completely different and certainly not related to this thread....which is about upgrading from Unity 4.
     
  5. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    622
    Good news everybody, 5.3f1 fixed all my performance issues.
    1) Scene loads like in 5.1.4
    2) FPS are now 60FPS like 5.1.4
    3) Graphics quality is now like 5.1.4 with normal compression!

    Everything is great! Well done Unity excepts the APK is now much larger! This is weird, it was 32mb and now is 52mb. How come? This has to be fixed. Also Unibill does not work, it has tons of error conflicting with Unity's own IAP and I had to erase it. That is bad since Unity IAP does not support Amazon and Samsung, at least not now!
     
  6. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    @giorgos_gs Unity IAP should not be linked to your project unless you enable it in the services window. What errors were you seeing?
     
  7. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    622
    Something with ILogger.
     
  8. ShadowAngel

    ShadowAngel

    Joined:
    Aug 7, 2012
    Posts:
    12
    Anyone else can confirm this?
     
  9. nspilanis

    nspilanis

    Joined:
    Sep 14, 2013
    Posts:
    4
    @ggunni This is what did the trick for me. I had about 108 images. After adding default material, performance was back to 60 fps. Thanks!
     
  10. ChiuanWei

    ChiuanWei

    Joined:
    Jan 29, 2012
    Posts:
    130
    how about 5.2.3f1??
     
  11. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,121
    No noticable changes for us in 5.3
     
  12. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    622
    Didnt have time to try yet
     
  13. Sokharev

    Sokharev

    Joined:
    Oct 10, 2013
    Posts:
    7
    Hello, we have the same problems in UI performance. Following your profilers data ("Clear/Present" eating too much) i've suspected that problem in fillrate and checked DefaultResourcesExtra/UI/UI-Default shader. here we have:
    Unity 5.x(incl 5.3beta, where _UseAlpha replaced to #ifdef):
    fixed4 frag(v2f IN) : SV_Target
    {
    half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;

    if (_UseClipRect)
    color *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);

    if (_UseAlphaClip)
    clip (color.a - 0.001);

    return color;
    }

    and if we see it compiled - it will be rolled to :

    void main ()
    {
    lowp vec4 tmpvar_1;
    mediump vec4 color_2;
    lowp vec4 tmpvar_3;
    tmpvar_3 = ((texture2D (_MainTex, xlv_TEXCOORD0) + _TextureSampleAdd) * xlv_COLOR);
    color_2 = tmpvar_3;
    if (_UseClipRect) {
    highp float tmpvar_4;
    highp vec2 tmpvar_5;
    tmpvar_5.x = float((_ClipRect.z >= xlv_TEXCOORD1.x));
    tmpvar_5.y = float((_ClipRect.w >= xlv_TEXCOORD1.y));
    highp vec2 tmpvar_6;
    tmpvar_6 = (vec2(greaterThanEqual (xlv_TEXCOORD1.xy, _ClipRect.xy)) * tmpvar_5);
    tmpvar_4 = (tmpvar_6.x * tmpvar_6.y);
    color_2 = (color_2 * tmpvar_4);
    };
    if (_UseAlphaClip) {
    mediump float x_7;
    x_7 = (color_2.w - 0.001);
    if ((x_7 < 0.0)) {
    discard;
    };
    };
    tmpvar_1 = color_2;
    gl_FragData[0] = tmpvar_1;
    }
    And i believe it's "too heavy for mobile" - i'am not sure but i think most of android GPU's can't avoid branch and doing "all program" and/or anyway any "if" in fp are heavy ( correct me if i'am wrong )
    So let's see in shader for Unity 4.6.9:
    fixed4 frag(v2f IN) : SV_Target
    {
    half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
    clip (color.a - 0.01);
    return color;
    }
    that's quite easier. But we could eliminate even clip most places.
    So to fix i'am offering following :
    1. download built-in shaders for your Unity 4/5.x version
    2. Extract UI-Default.shader( or what you're using )
    3. place it in your project assets folder and fix fragment shader to some kind of :
    fixed4 frag(v2f IN) : SV_Target
    {
    fixed4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color;
    return color;
    }
    Conclusion:
    1. i've not tested it on Android (don't have device currently) but i'am quite sure it can helps.
    2. some kind of UI "masks" can be broken , but for example scrollview working ok(perhaps this is because it's implemented via stencils ? ). anyway you could fix it by applying "proper" material only in certain place.
    Could someone test it out?
    Thank you.
    UPD: Just checked on Exynos 4412(Samsung S3) with 1280x720 resolution and we have 56fps vs 42 fps. so it's definately helps, perhaps on fullhd it will helps even more
     
    Last edited: Nov 28, 2015
  14. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    AFAIK both "if" and "clip" in shaders are bad for mobile. I think this is definitely something Unity should address.
     
  15. ChiuanWei

    ChiuanWei

    Joined:
    Jan 29, 2012
    Posts:
    130
    i know can use shader_feature instead of. but this will cost complie into difference shader and become bigger size when build.
     
  16. Fuzzy

    Fuzzy

    Joined:
    Feb 11, 2011
    Posts:
    266
    Created a simple 2d prototype in 5.2.3f1, nothing fancy, very few, simple objects, only unlit and sprite shaders, minimal amount of text UI, no light sources, minimal physics, no audio yet. No 32bit buffer and disabled depth and stencil buffer - didn't change anything on the following.
    The result was: lagspikes and somewhat choppy 50fps on my target phone, Xperia Play, with a 1GHz core to see if it will run fine for most people all around the world.
    It also started out jumping between 10 and 30 fps for the first 10 seconds while everything was already on screen, loaded and running.
    Annoyed and reminded by the fact that 5.x has Android issues i recreated the project in 4.6.9p3. Basically copied project folder, rebuilt the simple main game scene and set the project settings to the same as i had in 5.x wherever possible.
    And as expected it ran smootly with constant 60fps from the start, no lagspikes.

    If a reaction based game has framerate issues and/or lagspikes it's a total showstopper.

    I wish they could pin down and fix the issue already, it's the only reason i can't use the fancy 5.x version.
    (But now this makes me glad i cancelled my Unity 4->5 pro upgrade preorder, so at least i didn't spend extra money to have something that doesn't run properly)
     
  17. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    622
    I have already bought unity 5 and I am seriously thinking of downgrading to 4.6.9 for the reasons you said. Its too laggy,at the first seconds, makes your project look bad.
     
  18. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Well this is the big trap, we forced to upgrade Unity 5 to take advantage of the new mobile features.
    Windows 10 Support, Apple TV and much else. On 4.6.9 u get good Android FPS but lot of users will complain of graphic driver issues and also you miss out on proper Android 6 support..
     
    Fuzzy and larku like this.
  19. Deleted User

    Deleted User

    Guest

    My problem mostly comes from lighting needed in a scene and it does not matter how fast or beefy the computer is that I have used. If during a test scene and not using the Game Editor scene window or run game part, and just using the build and run making sure to turn off all the lighting settings (so it does not freeze up building scenes, and set the windowed preview as a run game setup to Fastest, when most the light features are shut off the things go fine.
     
  20. YKpro

    YKpro

    Joined:
    May 14, 2013
    Posts:
    12
    we have the same issue on our project. it is a 2d game.
    when we upgrade from 4.6 to 5.0.2. it get worse.but not that worse.
    but after we upgrade from 5.0.2 to 5.2.3. it's getting far worse than 5.0.2.
    the main issue is the UI. if turned off UI ,it's OK. when open UI. it's horrible!!
     
  21. YKpro

    YKpro

    Joined:
    May 14, 2013
    Posts:
    12
    we have the same issue on our project. it is a 2d game.
    when we upgrade from 4.6 to 5.0.2. it get worse.but not that worse.
    but after we upgrade from 5.0.2 to 5.2.3. it's getting far worse than 5.0.2.
    the main issue is the UI. if turned off UI ,it's OK. when open UI. it's horrible!!
     
  22. Fuzzy

    Fuzzy

    Joined:
    Feb 11, 2011
    Posts:
    266
    Tried 5.3.0f4 with best hopes today on the very simple 2D thing i described a post earlier and now logcat spams me with:
    Over and over again when the game is running.
    And instead of having a 'somewhat' stable ~50fps after ~5-10seconds as before it now crashes with:
    (The game runs with 20-45fps for 5-10 seconds then crashes)
    I wonder where "Copying /data/tombstones/tombstone_07 to DropBox" goes to... I'm not using drop box.
     
    MrEsquire likes this.
  23. sngdan

    sngdan

    Joined:
    Feb 7, 2014
    Posts:
    1,131
  24. sh0v0r

    sh0v0r

    Joined:
    Nov 29, 2010
    Posts:
    320
    5.3 Android build is terrible for me, went from 60+ FPS to 15...
     
  25. TimGS

    TimGS

    Joined:
    Apr 24, 2014
    Posts:
    70
    File a bug report then.
     
  26. SixFootKid

    SixFootKid

    Joined:
    Jan 16, 2015
    Posts:
    1
    Our android build was 60 FPS using Unity 5.3.0f2, but we dropped below 30 after updating to the official release 5.3.0f4.
    After some testing we've managed to get back to our original frame rate by disabling the OpenGL ES3 so only OpenGL ES2 is being used
     
  27. jacknorrisuk

    jacknorrisuk

    Joined:
    Jun 17, 2014
    Posts:
    38
    Time for me to pipe in at this point, after the 5.3.0f4 update - problem still not resolved, sadly. Still have massive consumption (80%) under Device.Present on the profiler. Sometimes reaching as low as 5fps. In 5.1.4 it rarely strayed below 30.

    Many theories pointing towards UI as the problem, but there is still a suggestion that the issue is still there even in a very simple scene with no UI elements at all.

    We're so close to releasing our app, but this throws a massive spanner in the works!
     
  28. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    And here we go again...:)...

    Always wait for the first patch...
     
  29. TimGS

    TimGS

    Joined:
    Apr 24, 2014
    Posts:
    70
    It seems I'm lucky.
    5.3 gives me the best performance I've ever had on 5.x. =)
     
  30. jacknorrisuk

    jacknorrisuk

    Joined:
    Jun 17, 2014
    Posts:
    38
    Hah, indeed, but when you're already 2 weeks behind schedule because of this ridiculous problem, we have no choice but to try every version available!
     
  31. Dejmien

    Dejmien

    Joined:
    Jul 10, 2014
    Posts:
    6
    I am testing my game on 2 devices: LG L7 and LG Spirit 4G LTE.

    With Unity 5.1.2 my game runs 19-25 fps on L7 and has big physics spikes in profiler. On LG Spirit it worked smooth, 60 fps.

    I hoped that Unity 5.3 will resolve my problem but... Now my game runs 30-35 fps on L7 (pretty nice), and 19-25 fps on Spirit.
     
  32. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Hey @Dejmien,

    Does you performance improve if you force OpenGL ES2 in the player settings?
     
  33. Dejmien

    Dejmien

    Joined:
    Jul 10, 2014
    Posts:
    6
    Just a little bit.

    Sorry, maybe I'm doing it wrong. Where can I change to OpenGL ES 2.0 in player settings? I realized that i changed to OpenGL ES 2.0 in build setting but I don't know if it's the same...
     
    Last edited: Dec 9, 2015
  34. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Sorry, yes the build settings.
     
  35. sh0v0r

    sh0v0r

    Joined:
    Nov 29, 2010
    Posts:
    320
    Cheers, we'll take a look at that!

    Say hi to Kimbo for me ;)
     
  36. MinhDao

    MinhDao

    Joined:
    Oct 28, 2013
    Posts:
    155
    Same here.
    (Nexus 4, Android 5.1.1)
    OpenGL ES 2 : 40fps
    OpenGL ES 3 : 20fps
     
    Last edited: Dec 10, 2015
  37. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,121
    People should at the very least report their device models.
     
  38. sh0v0r

    sh0v0r

    Joined:
    Nov 29, 2010
    Posts:
    320
    Samsung Galaxy S6 - SM-G9201 - 5.1.1
     
    Prodigga likes this.
  39. Azmar

    Azmar

    Joined:
    Feb 23, 2015
    Posts:
    246
    Unity 5.1.3f, after about a day trying every 5.2 and 5.3 options, 5.3 literally would make game run at 60fps so I gave up on that option. Our game runs at 30fps on Samsung S4, I tried every trick on page 9 where the guy quoted everything to test. We did lighting, project settings, shader stuff, etc for the entire day. Some tweaks from that post did improve stuff by 1-5 fps here and there and pushed us to 40fps. Baking, skybox changes didn't seem to do anything if we removed them or had them.

    Getting our project from 40fps to 60fps, we tied it down to the terrain. We noticed that it was still pretty crappy fps with only terrain and light source. And lighting didn't change much so we thought it was the terrain. After messing with the terrain settings we changed Base Map Dist. from 1000 (our setting) down to 0 and our fps jumped up about 15fps, also increasing pixel error from 5 to higher also further improves it. Terrain seemed to be holding our project back heavily.

    Would like to add, after leaving project on in all 5.X versions of unity for after 15min of idling on android phone the fps starts to drop -10 fps, and after 5min another -10 fps! Lasts like this for another 10min and eventually goes back up in stages...anyone know what is causing this?
     
  40. ChiuanWei

    ChiuanWei

    Joined:
    Jan 29, 2012
    Posts:
    130
    why should use ES 3???
     
  41. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Because the option is there considering ES2 many years old and Unity should fix the problems !
     
  42. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Fixing a problem requires Unity to understand it. It is necessary to know on which devices those performance issues occur, including information like Android version and graphics driver version.
    However, productive solutions or helpful feedback doesn't seem to be the nature of this thread.
     
  43. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,121
    Android devices throttle down the GPU based on the tempreture/workload on the device. Some throttle more agressively than others...

    If you open up the Monitor and view the system logs, you will see logs from ThermalEngine or something like that, informing you that the GPU has been throttled down.

    This is what it looks like on my Nexus 6p. This kicks in as soon as the device starts to get hot. My framerate is more than halved when this happens (60FPS -> 20 FPS)

    Code (CSharp):
    1. 1-20 17:33:12.339: I/ThermalEngine(3819): ACTION: GPU - Setting GPU[0] to 510000000
    2. 11-20 17:33:13.343: I/ThermalEngine(3819): ACTION: GPU - Setting GPU[0] to 450000000
    3. 11-20 17:33:19.357: I/ThermalEngine(3819): ACTION: GPU - Setting GPU[0] to 390000000
    I think this could be the source of a lot of seemingly 'random' performance problems with Android. I encourage you all to open up the Monitor.bat, and read all the logs while your game is running. Take note of when the performance drops - It might happen immedetiely on launch! I have a suspecion that workload is a contributing factor to the GPU throttling.. A 'heavy' game might get throttled early/on launch to prevent the device from heating up.
     
  44. BossyBear

    BossyBear

    Joined:
    Dec 10, 2015
    Posts:
    1
    LG G4, Android 5.1, 2D Unity project

    On Unity 5.2.3 performance is a rock-solid 60 FPS using GLES3.
    On 5.3.0f4 performance drops to ~20 FPS using GLES3. It goes back up to 60 FPS if I use GLES2, but there's some graphics corruption related to reflection probes.
     
  45. Fuzzy

    Fuzzy

    Joined:
    Feb 11, 2011
    Posts:
    266
    Got another 2 profiler screencaps here. (disableing 32Bit buffer and leaving only OpenGLES2 in Graphics API doesn't change anything on the results).

    Sony Xperia Play [Adreno 205] @ Android 2.3.4:
    Shows strong problems with Clearing the screen (Clear Flag is set to "Solid Color"), otherwise it would probably run just fine.
    Ingame FPS prefab from unitys' utility assets shows ~34fps


    Acer Iconia A510 [Tegra 3] @ Android 4.1.2:
    Seems to have some issue with Device.Present, that is eating up quite some FPS and would otherwise be reaching easy 60fps.
    Ingame FPS prefab shows ~50fps.


    This still matches with the results i've been getting earlier, back in march 2015:
    Xperia & Clear being bad: http://forum.unity3d.com/threads/ve...grading-to-unity-5.306572/page-2#post-2011114
    Acer & Device.Present being bad: http://forum.unity3d.com/threads/ve...grading-to-unity-5.306572/page-2#post-2015959

    Even though this time the profiler screens are from another project.
    But it's pretty much the same in every 2D or 3D project i run on the devices.
     
  46. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    You posted previously that have have submitted bug reports for those. What are the case numbers? I am sure a lot of people who watch this forum are keen on voting for them.
     
  47. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    240
    unity 5.3 last version really bad , my favorite on unity 5 is version 5.1.2f but is not better like unity 4.6 ...
     
  48. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    622
    I tried 5.3 today and its not bad. Its way better than 5.2 and almost the same performance than 5.1.4. this works for me, I will use it.
     
  49. mentolatux

    mentolatux

    Joined:
    Nov 2, 2014
    Posts:
    240
    same project i try it on unity 5.3.0f4 and unity 5.1.2f and the winner is 5.1 , 5.3 much lag on my game
     
  50. Fuzzy

    Fuzzy

    Joined:
    Feb 11, 2011
    Posts:
    266
    They closed my report from back then saying the bad performance came from the standard shader, which is from what i can see bs, because it's happening with all sorts of shaders and even empty scenes.
     
    MrEsquire likes this.