Search Unity

Very poor performance on Android after upgrading to Unity 5

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

  1. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Yes, remove the skybox from the camera, but keeping it in the lighting menu doesn't cause any issues for me so far... :D
     
  2. Fuzzy

    Fuzzy

    Joined:
    Feb 11, 2011
    Posts:
    266
    Luckily I have unity4 android pro, and i have rebuilt the scene there:


    Most of it is just WaitForTargetFPS as I expected it to be.
    it sometimes moves from WaitForTargetFPS to Device.Present, but it always stays at easy 60fps, right from the start on the weaker Xperia play.
     
    Last edited: Mar 16, 2015
    plasmabazooka likes this.
  3. maxj92

    maxj92

    Joined:
    Feb 16, 2015
    Posts:
    1
    Also getting bad performance after upgrading to Unity 5.0, my game is very simple and the FPS drop is noticeable even on the first screen (With simple Start button, not GUI). I followed some advice in this thread and turned on profiling, the strange thing is when development build is enabled my game runs fast (like normal) but when I build it without development build enabled, I have the FPS drop, so I am unable to use profiler to see why, as my game plays fine in development build. Any other reason for this?

    EDIT: Nexus 6 32G device

    EDIT2: Game runs fine on old Samsung S2 in Dev build and non dev build
     
    Last edited: Mar 16, 2015
  4. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    Heh... I had the opposite issue, i.e. I got really bad performance with profiler on!

    And you might have read this already, but the issue one of the Unity guys stated about the JobScheduler mucking up on some devices could be the cause for your slowdown. Still weird that a dev build vs a non-dev one would be so different...

    That non-dev build lag warrants a bug report. See how many times you can reproduce the issue and if it's more than say two or three times then you have a perfect lemon to send to UT for analysis! :)
     
  5. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    Hear, hear!
     
  6. FuzzyQuills

    FuzzyQuills

    Joined:
    Jun 8, 2013
    Posts:
    2,871
    @bitter: I actually have a bug to report, but my school network blocks all the ports it uses, so I will post it here instead.

    Basically, some syntax errors aren't picked up by the shader process, and likewise, it compiles properly on D3D9/D3D11. But then the same shader, because of the syntax errors, crashes the shader compiler on building for android! :eek: On top of that, using SV_Target with certain shaders makes the shader compiler generate syntax-error-ridden GLSL, and likewise, the target device doesn't run it.

    Will produce two examples when I get time. Might pull out my 4.6 version of the shader, and put the syntax issues in for analysis! Oh, and likewise, I might have to copy the shader that had the issue, and rollback some of it's re-writes. Only then do I have a lemon... ;)
     
  7. Fuzzy

    Fuzzy

    Joined:
    Feb 11, 2011
    Posts:
    266
    Any news about this?
     
  8. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    Some. We are still working on a fixes for these issues. However, I can tell you that Unity 4 is lying to you :) WaitForTargetFPS is actually hiding the work performed by the GPU. Most of that time should be attributed to Present. The thing is that on Android it's not really possible (without access to the actual hardware counter) to distinguish VBlank wait from GPU being busy.

    That said, it seems the biggest reason we no longer hit 60fps on xperia play is because the default screen buffer in Unity 5 is 32bit. This was a bit of an oversight on our part so we will make sure to fix that. To get a real estimates on the GPU I recommend installing Adreno profiler - It works great with xperia play out of the box (at least mine did ;-))
     
  9. Fuzzy

    Fuzzy

    Joined:
    Feb 11, 2011
    Posts:
    266
    Gave that Adreno Profiler a try, but it seems that for cpu/gpu/timeline capturing I need to root my device?

    As for the 32bit thing, in my test scene it has already been disabled, though i'm not 100% certain right now if that was the case in the version i submitted.

    But with VSync, legacy/mobile shaders @ 8 draw calls / 100 Tris & 196 Vertices, barely any script, no profiler, no 32bit display buffer hitting only 45fps on that device is shocking. Almost the same bad performance for tegra 3, those were a few years ago gaming devices/chips. Like for example also used in the OUYA.
    I wonder if it performs well on other devices and i just chose the wrong ones to test on, or how this went unnoticed.

    And even though U4 may be lying to me in some way with the profiler, it doesn't change that it performs way better. :p
    Could give examples with this @ stable 60fps on xperia play (with game logic running, player physics, [not on screen] skinned mesh renderer enemies, there were also a bunch of 2d animated items, just already collected on this screen i dug out) - all no problem.
    And this @ ~50-60fps on Tegra 3 on OUYA. (with game logic, good amount of physics/raycasts, few nav agents, bunch of particle systems, even a fullscreen mobile bloom image effect and more)

    To me it seems U5 Android isn't really suitable for production right now.

    tl;dr: I really hope you can do something about this!
     
    ardacankirkoc likes this.
  10. TranquilMarmot

    TranquilMarmot

    Joined:
    Nov 5, 2013
    Posts:
    2
    I'm having this same issue with a Nexus 6 running Android 5.0 with a very simple scene. Curiously enough, the game seems to run just fine (100+ fps) when I connect USB debugging and run the profiler. Close the profiler and the game comes to a standstill. Start the profiler back up and everything starts running fine again...

    I tried the same scene on my Nexus 7 (2012, also Android 5.0) and it runs just fine, profiler or not. Also runs perfectly fine on my Nexus 4 (also Android 5.0).
     
  11. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    And this is with VSync enabled? Nexus 6 doesn't work well if you try to render a scene without VSync enabled.
     
  12. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    As I said, this is most likely due to the screen buffer always being 32bit. This also takes it's toll on Tegra3 which is very fond of 16bit buffers.
     
  13. teemukorh

    teemukorh

    Joined:
    Oct 28, 2014
    Posts:
    49
    I'm also experiencing -70% in fps for samsung nexus. Have tried vsync and disabling everything in scene. Just cannot find anything specific.
     
  14. bitter

    bitter

    Unity Technologies

    Joined:
    Jan 11, 2012
    Posts:
    530
    Nexus S?
     
  15. antx

    antx

    Joined:
    Feb 16, 2012
    Posts:
    28
    I don't know about fps but the buttons of my UI react very poorly on android. Sometimes I have to tap them 5 times and more until they finaly respond. (nexus 7 2012 (android 5.1) and a cheap Medion livetap (android 4.2)).

    Once I tap an inputField and the android keyboard comes up then this keyboard respondes very much better than my unity UI.

    Another app I made with unity 4.6 running on the same devices has no such problems.
     
  16. teemukorh

    teemukorh

    Joined:
    Oct 28, 2014
    Posts:
    49
    Samsung Galaxy Nexus. Also just tested with Nexus 7 (Asus) and HTC One, where enabling the v-sync improves the fps. On samsung galaxy nexus an empty project with camera will run about ~40fps.
     
  17. antx

    antx

    Joined:
    Feb 16, 2012
    Posts:
    28
    I spend a day to port my app back to unity4.6 and tested it on android. It is indeed much better. Tapping a button or an inputField (almost) always responds as expected.
    So Unity5 seems to have a problem there with the UI and speed/input responces.
     
  18. Deanit

    Deanit

    Joined:
    Nov 29, 2013
    Posts:
    6
    For my project it seems that not only UI became slow in Unity 5...

    For some unknown reason it seems that on my old devices (Motorola Xoom 2 ME and PMP5570C) physics work extremely slow. On the other hand, LG G2 mini has normal performance as it was with Unity 4.6.
    Symptoms: Scene containing no rigidbodies renders at good fps, but just after 5-6 rigidbodies are added to scene (with permanent (discrete though) collision to each other), fps drops to 5 and becomes very unstable.

    As for UI, it works quite fast on LG G2 mini and on PMP5570C, but on Xoom 2 ME it cannot render more than 20 fps with a single fullscreen RawImage component, so I think it depends on graphic adapter's driver.

    I so much hope this post to be read by developers, because it appears that current state of Unity 5 cannot be used for creating mobile games...

    Update: issue was in 2 my mistakes:
    1) if using lightmap, always turn off shadows on enabled lights, even if there are no mesh renderers taking or dropping shadows.
    2) some devices completely cannot stand Mobile/Transparent/AlphaBlended shader on your mesh (non particles). Some devices just don't render it, some have huge lags if set up so.

    So, no Unity fault here, I can blame only myself ))
    However new UI is still very slow on Motorola Xoom 2 ME (from 4.6 to 5.0p3)
     
    Last edited: Mar 28, 2015
  19. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    You don't really know what the cause of the issue is. If you want anyone from Unity to investigate your specific regression, you have to submit a bug report and optionally post the case number here in case someone from Unity sees it.
     
  20. Deanit

    Deanit

    Joined:
    Nov 29, 2013
    Posts:
    6
    Yep, you are right. I am about to create a sample project to submit it to Unity developers.
     
  21. Otsego

    Otsego

    Joined:
    Jun 9, 2013
    Posts:
    5
    I created new empty Unity5 android project and ran it.
    Look at logcat:


    These messages are infinite and have no delay in appearance.
    Is it okay?
    Device: HTC Desire C.
     
  22. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,122
    I've just built my latest game to Android on Unity5.0P3 and the performance drop is a shipping killer. It's gone from a solid 60+fps to 20fps on my test device (nexus 7) It's a 2d game using only NGUI for the ui and sprites. I've profiled it and can't see the problem so I systematically disabled stuff to find the cause.

    I had 2 cameras, one for 2d and 1 for 3d stuff in the background. The one 3d object was a sphere using the space unity plugin planet shaders. Swapping this shader to a crappy mobile defuse shader increased it from 20fps to 40fps. Then removing the skybox from the 3d camera got me back the last 20fps. BUT I need both the planet shader and the skybox!


    Unity are you fixing the skybox problem? and how do I fix the planet shader problem.
     
  23. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    What kind of skybox are you using? Currently only the procedural skybox (default) is known to be expensive.
     
  24. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,122
    I didn't know there was more than one type. I just had a look, it's using a shader called skybox/6 Sided (exposure=1, rotation=0) The camera had the skybox component on it pointing to this material/shader, the camera clear settings were set to skybox. There must be a unity bug here as the same shader used almost nothing on 4.6
     
  25. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    350
    Just wanted to add my voice - I also have problems with performance on Android, with a pretty simple game, where I just can't believe it should create problems. It's maybe not the best idea to animate uGUI elements with DOTween, but in the end I just do it from time to time, not always. The best performance boost I got by switching from Forward Rendering to Vertex Lighting, but that can't be the solution.
     
  26. Pharaoh

    Pharaoh

    Joined:
    Jan 8, 2014
    Posts:
    28
    I also have very bad performance with Unity 5 on android.
    I have scene with about 30k tris. That scene worked with 60fps on Unity 4.6.
    And that was free version so I didn't had any of PRO features.

    I hoped that it would be even better in Unity 5. I tried it on version 5.0.0. Draw calls have been reduced and in Editor everything works like it should, but when I deploy it my Nexus 4 device, I get terrible results. Scene lags and framerates goes from 20fps to 40fps. I'm very disappointed. I'm using mobile shader. Basically I didn't have time to alter the scene, I just wanted to try how the same game/scene worked when compiled with Unity 5 instead of Unity 4.6.
     
  27. studentvz

    studentvz

    Joined:
    Dec 14, 2014
    Posts:
    149
    I also have problems after switching from 4.6 to 5.0. Same project, same everything and when apk is build with Unity 5 I get only 20-30FPS (on Unity 4.6 I get 60+FPS).

    Device: LG G3
     
  28. ratking

    ratking

    Joined:
    Feb 24, 2010
    Posts:
    350
    5.0.1 seems to have improved the performance for me. Especially when displaying uGUI.
     
  29. Pharaoh

    Pharaoh

    Joined:
    Jan 8, 2014
    Posts:
    28
    5.0.1 didn't solve issues for my project. I'm still getting terrible fps on android.
     
    Gekigengar and MrEsquire like this.
  30. studentvz

    studentvz

    Joined:
    Dec 14, 2014
    Posts:
    149
    Installed 5.0.1 and it is the same. Also I tryed with UI and without UI and FPS is the same.
     
  31. z37

    z37

    Joined:
    Feb 13, 2014
    Posts:
    29
    New 5.0.1f1 patch has solved issues on my Nexus 7 2013. Now everything is smooth 60 fps. Some Low Cpu Fly and LG devices show good performance too comparing to 5.0.0
     
  32. wangzy_88

    wangzy_88

    Joined:
    Sep 12, 2012
    Posts:
    14
    I also get stuck on Android about Loading.LoadFileHeaders:
    LoadFileHeaders.png
    What's this?I test at least three devices.
     
  33. Raffel

    Raffel

    Joined:
    Apr 12, 2014
    Posts:
    1
    I think I found a bug, when I check the static box on an object, the fps drops!
     
  34. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    This is not necessarily a bug. Static objects are merged with others if possible. This can heavily increase the vertex count in certain situations, because the static mesh also contains lots of objects that are out of sight and would have been culled away without the static batching.
    If you want to investigate this further and get help from others, it would be worth to start a new thread as it doesn't seem related to the original topic of this thread.

    Edit: Forget about it. This is completely wrong!
     
    Last edited: Apr 6, 2015
  35. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,122
    I've just tried 5.01 and it made no speed improvement for me. My scene only has 5.3k Triangles and 3.2k verticies, 11 batches which I'm assuming is U5's name for draw calls. Most of the scene is NGUI sprites and I am really struggling to get back to 60+fps.
     
    Gekigengar likes this.
  36. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    What is the profiler saying?
     
  37. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,122
    Thats just it, the profile doesn't seem to show anything wrong or out of the ordinary, just very bad performance. I've just replaced another shader and the game now peaks at 60fps, but it's always on the underside, whereas before on U4 it was a comfortable 60+. I'm using nothing fancy at all, just 2 lights in the scene, quality set to low, turing of the NGUI panels fixes the problem so I now suspect something in NGUI is slowing stuff down on Android on U5
     
  38. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    How do you measure the framerate?
     
  39. Fuzzy

    Fuzzy

    Joined:
    Feb 11, 2011
    Posts:
    266
    I still have those framerate issues on very basic scenes, too.

    In my case I have tried a few framerate measurements:
    • A text mesh updated every 0.5sec with the framerate calculated.
    • Unity's given fps counter prefab using legacy GUI text.
    • And of course the profiler when trying with development builds.
    All of them show the same.
     
  40. arkon

    arkon

    Joined:
    Jun 27, 2011
    Posts:
    1,122
    i have a frame rate script and a NGUI label on screen that I've used since year dot. It's always been accurate in the past. I've now wasted enough time on it and have moved on. Maybe we need to wait for Unity 5.6 before we get our mobile performance back.

    Oh and I just discovered changing the NGUI unlit shader on the atlases to the new unity UI standard shader gave me a couple of fps extra. U5 seems to not be playing nice with legacy shaders.
     
    MrEsquire likes this.
  41. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    639
    http://docs.unity3d.com/ScriptReference/StaticBatchingUtility.html

    Static batching will increase memory usage, but has no effect on vertex count, it has frustum culling for each mesh just like without batching.
     
  42. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    I don't know what I was thinking when I wrote this! You are certainly right! I must have confused it with combine, though, not sure how I confused it with that one.
    Thanks for the correction!
     
  43. Derek-Wong

    Derek-Wong

    Joined:
    Jan 5, 2015
    Posts:
    16
    In my case everything works fine except particles. When it was 4.6 all particles system works great but when I use unity 5, when there is particle in the scene (or many particles), the performance drops dramatically. I have tried Vsync or some other methods mentioned here but not really works. Please fix this issue ....I have upgraded the project and don't have back up....(cry)
     
  44. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Hi Derek,

    Not helpful for your current issue, but there is no way I could ever do any development and not use a source repository (that I commit to at least once a day). Imagine if (when - because it will happen one day) your HDD crashes - you'll lose everything.

    Seriously I'd make it a priority to use something like git (perhaps with bitbucket - free private repo) and start version managing your projects (backup, wind back to any checkin, compare code to repo to find changes, create branches, etc)..
     
  45. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    Have you tried Unity 5.0.1? Particles could be affected by problems with the internal job system mentioned earlier in this thread. Most of these problems should be fixed since Unity 5.0.0p3.
    Have you used the profiler to check if the time is spent on particles?
    If you still see the slowdown in 5.0.1 then please submit a bug report with repro project.
     
  46. Derek-Wong

    Derek-Wong

    Joined:
    Jan 5, 2015
    Posts:
    16
    Hi Larku,

    Actually I have regularly backup my project, but my problem is, I have worked on it for about a month AFTER I have upgraded to Unity 5, so if I want to go back to Unity 4.6, I would have lost those works....and that is nearly impossible for me to do so :( too much work there.

    florianpenzkofer,

    Thanks for your advice, I will try 5.0.1 asap, but I have just found that removing all the particle system have not improved the performance. My scene that experiencing a really slow frame rate have a lot of UI elements in it and the structure is a job menu scene and have a job tree panel (the job tree panel structure is quite complicated), but the scene is smooth when I does not open the job tree panel (the job menu scene also have many other ui elements, but smooth@@).

    I will report if it works in 5.0.1 @@ hope it works, it really make me sad for a day, coz it run really smooth in Unity 4.6 build.
     
  47. Derek-Wong

    Derek-Wong

    Joined:
    Jan 5, 2015
    Posts:
    16
    Just a quick update, Unity 5.0.1f is not solving my problem.

    I have also set V-sync to no sync or Every V-blank...

    Don't know what can be done :/ I will try to find out what disabling what will make the frame rate increase...
     
  48. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    Ah, excellent (sort-of). My heart just skips a beat when I see a dev say "I have no backup" :)
     
  49. Derek-Wong

    Derek-Wong

    Joined:
    Jan 5, 2015
    Posts:
    16
    haha I have painful experience of not backup :( both in photoshop and unity.

    Btw, another update. I have connected profiler to my android device and I found that the slow performance is come from the "OTHERS" category. When I go into the slow scene (the job tree tag), 100% of the CPU usage is come from the others (maybe 99 %), and I believe it is come from an issue called "Loading.LoadFileHeaders".

    I guess, just a guess, it is the problem of Resources.load??? or something else?

    Here I attached my profiler log for you guys as reference @@
     

    Attached Files:

    MrEsquire likes this.
  50. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,422
    You'll notice a few others in this thread have found the same issue with LoadFileHeaders - so I assume you're on the right track.