Search Unity

Very poor performance on Android after upgrading to Unity 5

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

  1. digitalMUTANT

    digitalMUTANT

    Joined:
    Mar 3, 2015
    Posts:
    15
    My game project, built with Unity 4.6 runs at 70fps on Android, but know that i have just upgraded to Unity 5, the same game on the same device(LG L90) runs poorly at 20fps and crashes when exiting the app.

    I'm using Unity 5 (64bit) on Windows 7 x64, and a few third party plugins/components :

    iTween Plugin
    SimpleSQL Plugin
    Admob Plugin
    Google Play Services Plugin
    Chartboos Plugin


    Are you guys having the same problem?



    Thank you so much!


    Update :
    * I think that this slowdown problem in Unity 5 is somehow related to Canvas / UI Components...

    Now that I've disable the Canvas, the game became faster and runs at about 60fps.

    But obviously we need the canvas for game UI... :\

    * The crash on application exit ocurrs allways when i enable multithread rendering
     
    Last edited: Mar 5, 2015
  2. brockemon

    brockemon

    Joined:
    Dec 21, 2012
    Posts:
    48
    Lagging lag spikes...upgrade completed. Profile runs fine, getting ~ 150 ms lag. Trying www.rsclegacy.com with intermittent issues.
     

    Attached Files:

    Last edited: Sep 20, 2017
  3. losgatossuabes

    losgatossuabes

    Joined:
    Mar 12, 2014
    Posts:
    1
    I have just upgraded from 4.6 to 5.0 and I'm getting poor performance on Android as well.
     
    Gekigengar, digitalMUTANT and z37 like this.
  4. SiegfriedCroes

    SiegfriedCroes

    Joined:
    Oct 19, 2013
    Posts:
    569
    Same here! I'm making a retro styled 2D platform game. It's really basic and it used to run at a steady 60FPS on an old android phone. After upgrading to Unity 5 it's slower, less steady and drops to almost below 50 at times...
     
    digitalMUTANT likes this.
  5. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    This is what I was worried about, Unity 5 mostly everyone been testing new features and stuff, but mobile I feel has not been tested well and neglected in some way. All these new features may have had some kind of impact on mobile performance for all mobile platforms. Less see if someone can use profiler and find the culprit.

    Try using Android profiler to see where you are getting performance spikes..
     
  6. digitalMUTANT

    digitalMUTANT

    Joined:
    Mar 3, 2015
    Posts:
    15
    I think that this slowdown problem in Unity 5 is somehow related to Canvas / UI Components...

    Now that I've disable the Canvas, the game became faster and runs at about 60fps.

    But obviously we need the canvas for game UI... :\
     
    Last edited: Mar 4, 2015
    ChiuanWei likes this.
  7. SiegfriedCroes

    SiegfriedCroes

    Joined:
    Oct 19, 2013
    Posts:
    569
    Yeah I think it has something to do with 2D element rendering. Did anything change in the Sprite Shader?
     
    digitalMUTANT likes this.
  8. wo262

    wo262

    Joined:
    Mar 3, 2015
    Posts:
    2
    It's Vsync, at least in my case. I turned Vsync on "Every V Blank" in the Quality tab and it worked. Give it a try to see if your problem is the same

    I can confirm this same problem on my LG Optimus L9. I tried to discard any other factor, wasn't any of the new features, wasn't the shaders or sprites, wasn't the UI, wasn't the polycount, the scripts or the fixedupdate, any of that.

    Finally I got it to work with Vsync. But why? Shouldn't it be the opposite? Vsync hurting the performance? I think they inverted the value of the Vsync button in Unity 5 or something, since "Every second V Blank" hurts the framerate the same as Vsync off does, but "Every V Blank" doesn't. Or maybe it has something to do with the new changes it says here http://unity3d.com/unity/whats-new/unity-5.0 under the "Improvements, Android" section.
     
    Untherow, ZubakIVAN and hopeful like this.
  9. digitalMUTANT

    digitalMUTANT

    Joined:
    Mar 3, 2015
    Posts:
    15
    Glad to ear that you solve your problem, wo262.
    But, didn't work for me... :(
     
  10. wo262

    wo262

    Joined:
    Mar 3, 2015
    Posts:
    2
    Aww, what a shame.
     
  11. digitalMUTANT

    digitalMUTANT

    Joined:
    Mar 3, 2015
    Posts:
    15
    I have a scene with 3d objects(terrain, meshes) and a UI based on the Unity UI interface, that runned smoothly (70/80fps) with Unity 4.6 on a Android device.
    Once i've upgraded to Unity 5 I can get only 15 to 30 fps... but if I disable the Canvas or all UI Components i can get back to 80fps... :s

    That's why I suspect the problem has to do with the 2D / Canvas rendering...
     
    Last edited: Mar 4, 2015
  12. brockemon

    brockemon

    Joined:
    Dec 21, 2012
    Posts:
    48
    Guys,

    For me it was that Unity 5 does not deal with loading resources as well. i.e. Resources.Load is much slower.

    I hadn't yet set up pooling in my project so after doing this things were running 60fps once again.

    Hope this helps.
     
  13. z37

    z37

    Joined:
    Feb 13, 2014
    Posts:
    29
    I have the same issue with fps drop to 15-30 after migration to Unity 5. Even disabling of UI canvas does not work either.
    The only external plugin I use is DOTween, but as far as i know it is optimised for Unity 5
     

    Attached Files:

    Last edited: Mar 4, 2015
  14. fearfactory

    fearfactory

    Joined:
    Jun 11, 2013
    Posts:
    49
    Unity 5 doesn't work well with assets I bought from the store and is preventing batching. The assets are high quality Manufactura K4 assets.

    I am also getting random errors saying I can't use image effects since I don't own Pro.

    Performance and lighting quality is also lower.
     
    Last edited: Mar 5, 2015
  15. RomanVys

    RomanVys

    Joined:
    Mar 4, 2015
    Posts:
    8
    I have the UI problem in my project too, with 4.6.3 i get 60 Frames on my device and with 5.0.0 i get only 15, when i disable it, it works fine.
     
    digitalMUTANT likes this.
  16. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    It might be an idea to indicate what 'my device' is..
     
  17. z37

    z37

    Joined:
    Feb 13, 2014
    Posts:
    29
    So, has anyone submitted an issue? How to let unity developers know about this problem?
    It happens on both Nexus 7g2 and Nexus 5
     
    digitalMUTANT likes this.
  18. Sunwest3d

    Sunwest3d

    Joined:
    Mar 5, 2015
    Posts:
    13
  19. digitalMUTANT

    digitalMUTANT

    Joined:
    Mar 3, 2015
    Posts:
    15
    I submitted an issue yesterday, but with the same description from the first post. Since then, we find that the problem could be related to Ui/canvas/2d rendering... maybe its a good idea to update or register another issue.
     
  20. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    I cant even get the sample assets project to run on my kindle fire hd 8.9
     
  21. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Anyone done a logcat on this? Maybe logcat will reveal what's going on. (Well, if you have internal profiler and debug build ticked, that is!) That way, if some random error message is logging over and over and causing slowdown, then we have our issue right there! :)

    Once I get home, I will see how my game fairs in the UI dept. Might as well take this as a grain of salt though, as my game's UI elements are only used inside the main menus, and not the game itself. (The game itself uses legacy GUI from when the project was first started back in Unity 4.5 days)

    EDIT: Well, I will do a logcat... if my Android tab actually runs anything!
    I suspect I might have to buy a new device now, as I am not sure if my obscure tab even has NEON capability. Only an issue now that Unity 5 removes non-NEON devices from the list... :(

    EDIT2: Actually, just looked up my tab's CPU... I should be able to do one for you guys. (The CPU has NEON in it's extensions list)
     
  22. pmaloo

    pmaloo

    Joined:
    Jan 25, 2015
    Posts:
    35
    Similar issue. One of my games runs at 24-30 FPS on i9003 in Unity 4.6 but with 5.0 its down to 6-7 FPS. I was hoping for FPS improvement with GPU skinning and Static batching being made available to all but this is disappointing.

    Furthermore, it takes forever to do resources.load. Whats up with that?
     
  23. CyberScopes

    CyberScopes

    Joined:
    Oct 25, 2014
    Posts:
    7
    Glad im not the only one with this issue. Its quite weird because i havent added any new stuff. Vsync smoothed my main menu but i still get heaps lag in my actual game. Hope unity can get a fix soon.
     
  24. benlem

    benlem

    Joined:
    Nov 12, 2014
    Posts:
    2
    Same for me on Nexus 7 (2013) frame rate drop from 50 fps to 28 fps... Vsync or UI element removal doesn't change anything ..on profiler main usage is for Grpahics.present and sync or camera render depending on the option i choose (multithreading or GPU skinning) ...
     
  25. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
  26. pmaloo

    pmaloo

    Joined:
    Jan 25, 2015
    Posts:
    35
    It just seems the Rendering in general is slower in Unity 5 than in 4.6. I can't profile 4.6 project as I use free version but on 5.0, Camera.Render alone is taking 55-60 ms.



    Oh, and I didn't see any errors in Logcat that may cause issues. I also avoided automatic conversion of scripts so that GetComponent for rigid bodies, audio source, etc is only ever called once. I don't use them every frame/fixed update anyway. Been messing around for 3 days now but nothing seems to work. Back to 4.6 for now. Unfortunately, U5 has some major issues with mobile. Even my 2d game with fixed joints is going haywire but thats a different topic.

    Would be good if a Unity dev would address the concerns.
     
    Last edited: Mar 8, 2015
    MrEsquire likes this.
  27. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Strangely, I can't build at all with my converted Unity 4.6 project; every time I do it now, the UnityShaderCompiler process crashes with this:

    R6010:
    upload_2015-3-8_15-46-23.png
    Happens EVERY TIME it try to build & run with THIS project! :mad:

    I will also note that it's only started happening today, so I have no idea what's causing this... :(
     

    Attached Files:

  28. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    One more thing: i worked out a possible cause of slowdown on mobile!

    I found that for some reason, using skybox rendering doubles the processed verts in the scene. If any of you are using skybox as the camera clear mode, USE A SKYSPHERE MESH INSTEAD! :) Trust me, it will drop the vert count immensely!

    So if any of you are thinking it might be the UI, try this: it might give it a small boost. :)
     
  29. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    GODAMMIT. Problem above solved!

    I can't believe that repetitive crash was because of something as simple as this: Using CGINCLUDE to use multiple variants of a shader crashes the Unity 5 shader compiler process!

    I fixed the crash by moving the shader code to the Pass block instead.
     
  30. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Found a bug!

    It turns out the shaders weren't compiling properly: for some odd reason, shaders with syntax errors would compile fine under D3D9/D3D11, but compiling for GLES would cause the process to crash...

    Bug Report? :D
     
  31. z37

    z37

    Joined:
    Feb 13, 2014
    Posts:
    29
    Also don't forget to change Application.targetFrameRate to 60, because since Unity 5 it is set to 30 by default. So it made my game playing way above 30 fps, but it still lags, comparing to 4.6 build of the same game.
     
  32. plasmabazooka

    plasmabazooka

    Joined:
    Mar 8, 2015
    Posts:
    70
    I've got an issue with fps to.
    If I put on a ground surface the new shader of Unity 5 I've got fps 30-40 on Good quality settings and camera movement a bit laggy.
    But if I use a legacy diffuse bumped shader I've got fps over 60 and no lags at all.
    Tested on Galaxy Note 10.1 2014.
    With small objects there is no big difference in fps.
     
  33. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    @plasmabazooka: Well, I got the same issue with the standard shader there too with a test project, and that's most likely due to the standard shader being not quite ready for prime time... :D
    @z37: didn't affect me much; my project's already deliberately locked to 30 fps... :D
     
  34. plasmabazooka

    plasmabazooka

    Joined:
    Mar 8, 2015
    Posts:
    70
    Seems so. But would be good to know if the shader will be improved or we should stick with legacy ones for Android.
     
  35. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Still no official word from Unity??
     
    digitalMUTANT likes this.
  36. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Welp... until Unity say something, legacy shaders it is! :)

    Or in my case, my small mobile shader framework I built... :D I can give them to you if you like! :)

    What they do? They're try to be sort of between "Vertex-lit and bumped specular" i.e. I attempt to emulate normal mapping in the pixel shader. There are two: one for lightmapped scenery, and one for dynamic objects.

    I will have to do a bit of work to make them usable however, as atm, they use my own shadow mapping system I just built. ;) (The shadow mapper works like Super Smash Bros. Brawl zero-depth-test character shadows!)

    Anyway... probably a bit off-topic! :)
     
  37. digitalMUTANT

    digitalMUTANT

    Joined:
    Mar 3, 2015
    Posts:
    15
    Sorry, but I'm going to repeat myself.
    I dont know what is the cause of the problem(shaders, vsync, batchings...), but one thing i am sure: in my case, the frame rate only drops when i have Canvas/UI enabled. Even tweaking all those mentioned settings, did not solve the problem. The main thing is : the same project in the same conditions runs with huge performance difrence from one version of Unity(4.6) to another(5.0). So, it doesn't make much sense that we have to make tweaks, even if they really had solve anything. I think this should be solved by the Unity team, or at least they should say something about this...
    Also, I am worried that this version got released without any documentation...


    Please, understand that i'm not criticizing any of you guys, neither Unity... all of you are making a good job debuging this.
    I'm only telling what makes more sense, at least to me.

    Thanks! :)
     
    Last edited: Mar 8, 2015
  38. plasmabazooka

    plasmabazooka

    Joined:
    Mar 8, 2015
    Posts:
    70
    I've tried blank project with one big surface and one directional light without Canvas and UI and result was the same.
    As long as I used Unity 5 shader instead of legacy shaders fps drops to 30 from 60.
     
    digitalMUTANT likes this.
  39. digitalMUTANT

    digitalMUTANT

    Joined:
    Mar 3, 2015
    Posts:
    15
    How can we change the default shader used in sprite/ui rendering, without assigning a new material? I really dont know how... :(
     
  40. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Maybe putting your own UI shaders in place of "UI/Default" & "UI/Default Font" in graphics settings? Other than that, I have no idea. :D
     
  41. digitalMUTANT

    digitalMUTANT

    Joined:
    Mar 3, 2015
    Posts:
    15
    Thank you! I'll try that.
    (Funny that they rely those kind of setting in a list... with no references... only by index...)
     
    Last edited: Mar 8, 2015
  42. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yes, bug report skybox bug and also the cginclude bug and all the others. bug fix all for a chance at beta ;) go nuts.
     
  43. z37

    z37

    Joined:
    Feb 13, 2014
    Posts:
    29
    It seems like the this issue is only on android, on iOS everything works smoothly
     
  44. Sunwest3d

    Sunwest3d

    Joined:
    Mar 5, 2015
    Posts:
    13
    For the Hudl2 I managed to somehow fix the issue by forcing to OPEN GLES 2.0 in player setting and changing shader to Legacy/Diffuse then framerate went to 60 fps.

    I am still trying to work out how to improve the issue on my Kindle Fire HD even after setting legacy shader, changing VSYNC, removign canvas, forcing to OPEN GLES 2.0 removing audio and object and skybox. I am getting 50% slower frame rate. I literally have only a ball, a terrain with a camera left on screen and still getting 16-18 fps instead of 28-30 in Unity 4.6 with everything on.
    When I remove the terrain everything speeds up, Terrain is set to legacy shader.
    This is twisting my brain... I so wanted to use Unity 5.0...
     
    Krish-Vikram likes this.
  45. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    @Sunwest3d: well, here's what I did to get my game up to speed:
    - First, I tried the VSync glitch: WORKED!
    - Then, I re-wrote some of my shaders to be less expensive. (That was where I ran into those issues with the shader compiler! :D) That worked out really well! :)
    - After doing those, I was looking around for why my polys were so high, then found that the skybox clear mode doubles them for some odd reason... so I removed that, and it dropped back to the original poly count. (I substituted a sky sphere mesh in place of the skybox)
    - Also noting: I just put in a special type of shadow mapper designed for mobile, so that reduced the bottlenecks even further! :)
    - Any sort of slowdown related to Unity UI system isn't present during gameplay, as I still had the legacy system in place from Unity 4.5! :)

    So overall, my project runs fine now! :) The only laggy bits are due to a physX bug in one of the power-ups (Only there since Unity 5, damn you... :D) and the main menu, due to rendering a few clouds... :D (Single player menu using same cloud shader is lag-free!)

    For those who want a full listing, I am yet to post my findings in y WIP thread: http://forum.unity3d.com/threads/wi...-racer-for-android.267972/page-2#post-1999239
     
    Sunwest3d likes this.
  46. digitalMUTANT

    digitalMUTANT

    Joined:
    Mar 3, 2015
    Posts:
    15
    Glad to ear that you did solved your problem. :)
    I have not had the opportunity to take such measures but, personally, i think i'll stay with unity 4.6 by know... :s i dont want to make 1001 hacks & tweaks just to go back to a point that the latest version already assured it. :(
    Also, I'm worried about what's coming in next updates...
    Will we have to change a lot in our projects every time those updates are made?
    Hope that the Unity team solve this issues with the less impact possible for us.
     
  47. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    1001 hacks & tweaks... I did about 22! ;)

    And yea, hopefully, all these issues are solved in next 5.x release. Once I get time, I will file some bug reports on what I found. :)
     
    digitalMUTANT likes this.
  48. digitalMUTANT

    digitalMUTANT

    Joined:
    Mar 3, 2015
    Posts:
    15
    LoL I think you know what i meant
    about the "1001" hacks and tweaks. ;)
    And btw, thank you for your contribution to solving these issues! :)
     
  49. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    You're welcome! :)

    And the last of my lag issues should be fixed now: one of my scripts was doing something strange on top of everything else. (Not a Unity 5 issue, one of my collision checks needed a "debounce" mechanism to stop it popping 10 missiles instead of 3)
     
  50. pmaloo

    pmaloo

    Joined:
    Jan 25, 2015
    Posts:
    35
    Thanks for sharing your findings. But, the question is whether these tweaks should be necessary since these are just workaround for what are most likely bugs in Unity 5. From a developer standpoint, its probably better to stick with 4.6x while using as many U5 compatible practices as possible.
     
    digitalMUTANT likes this.