Search Unity

Very poor performance on Android after upgrading to Unity 5

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

  1. xxhaissamxx

    xxhaissamxx

    Joined:
    Jan 12, 2015
    Posts:
    130
    this setting make lightmap perfect and there is no dark shadow but problem still with LOD system anyone know to solve it :/
     

    Attached Files:

  2. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    738
    Unity 5 enables things like potentially using 1 draw call for an army of animated soldiers, for example on an opengl es3.0 , es3.1, es3.1+AES(aka es3.2) , and Vulkan for mobile (officially part of Android N (preview version 2), among many other features that can only be enabled on newer devices.

    So if your talking about optimizations for low end devices, then it is possible to just stay on unity 4.

    But if you want to target those super high end features (which btw you can make optional, or only support them on highest end devices if you want) then you will need to Upgrade to unity 5.

    So you know, the number of users on low end devices is shrinking by the day.
    You can now get quad core devices with decent graphics for $50. ive seen the high end shield tablet sold somewhere for $150 at one point, and thats a very powerful gpu.


    So your really only hurting yourself by staying there, instead of just learning how to take apart the standard unity 5 shader and take out parts that you dont want to effect performance.

    Unity 5 also has awesome new GroupLOD systems that is more powerful then the unity 4 lod system, because the GroupLOD uses something the render pipeline already uses.
     
    xxhaissamxx likes this.
  3. Krish-Vikram

    Krish-Vikram

    Joined:
    Aug 17, 2012
    Posts:
    8
    This Worked for me..
    Before this i tried, vsync, 32bit buffer, shaders, quality setting... nothing worked.
     
    xxhaissamxx likes this.
  4. amzin7000

    amzin7000

    Joined:
    Nov 16, 2014
    Posts:
    48
    Unbelievable. It has been ages and the canvas thing is still an issue in unity 5.4! Has anyone found a fix for the issue where using a canvas cuts the fps in half?

    I have a minimalistic 2d well-optimized game that easily runs at 60 fps on my old Moto x (from 2013) even using a few image effects like bloom and glow. However, on my much better Moto g (from late 2015), my game runs at 25 fps unless I disable all my canvases(which don't contain much at all). Using the same image effects makes the game unplayably slow(when coupled with he canvas lag).

    Anyone ever find a fix for the canvas lag?
    Its honestly driving me crazy.
     
    MrEsquire likes this.
  5. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817
    This is simple. unity5 doesn't designed for mobile games. unity 5 target is next gen consoles and upcoming next gen mobile devices. maybe in 2020
    I left unity5 in 7 month ago. and now after 7 month, I'm very happy with unity4 . Most of the unity fatal errors that i seen, is less than 10 errors in unity4. my games run smoothly 60 fps on mid range devices.
    I lost a lot of my scenes and works in unity 5 fatal errors

    For unity 5 visuals, i write some simple shaders and achieve unity 5 graphics with a lot better performance on mobile
     
    Last edited: Sep 4, 2016
    JamesArndt, amzin7000 and xxhaissamxx like this.
  6. amzin7000

    amzin7000

    Joined:
    Nov 16, 2014
    Posts:
    48
    Thanks aliyeredon2, but I really don't want to do that. There are a lot of upcoming 2d features that I'm going to use. I'd also like to stay up to date with all the assets I use and the new stuff comming to unity.

    I wrote all my shaders, and don't use shadows or other visually complex things, so my game is hyper-efficient, and it runs beautifully on mobile. But there has to be something that changed between the older and newer phones that unity has troubles with. I also really doubt unity would have traded in mobile performance for pc. That sounds very counter-intuitive for an engine really commonly used for mobile.
     
    Last edited: Sep 4, 2016
    LightingBox2 likes this.
  7. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    There no reason people should be suggested use Unity4 since then there been a ton of mobile related features and fixes added.

    Maybe Unity should just fix Unity 5 mobile performance if you have issue post a bug report to speed this process up!
     
  8. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817
    We have 2 choice:
    Performance <=> New Features

    I use unity 5.1.5 for 2D games and I think performance is better than newest.
    For UI, I use Control Freak Instead . my game is 2D racing game. Control Freak is only used for Throttle\Brake Pedals.
    I think Unity UI is only slow on Event Triggers.

    I'm 3d game developer and made this 2D game only for Money!!! :)
    But i could not reach 60 fps on mid range Mobile devices. Maybe i need some more work to reach better performance.
    This is my second 2d game...

    sorry for my bad English
     
    Last edited: Sep 4, 2016
  9. amzin7000

    amzin7000

    Joined:
    Nov 16, 2014
    Posts:
    48
    MrEsquire, I agree completely. The fixes and new features are totally worth it. You've been here since the beginning of the thread when people complained about slow performance with the canvases. Did anyone ever find a way to fix it? Its been about 3 years and this canvas problem has yet to be fixed. Unity 5.4 hasn't fixed anything when i was really hoping it would.

    aliyeredon2 Thanks, but regressing isn't my goal here, and though my game is minimalistic, it is multiple times more graphically complex than your game, and the older UI just won't cut it. A lot of things were optimized in between unity 4 and 5 and my old original protoypes certainly don't run as well in unity 4 as they do in unity 5.
    (Unity 5 webgl is also insanely great for having others playtest my game)
     
    Last edited: Sep 4, 2016
    MrEsquire and LightingBox2 like this.
  10. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    we need to make threads about canvas issue in the 5.5 beta forum. So it be fixed for the next major release.
    But they need bug reports and statistics, they dont take our word for it except if proof is provided..
     
  11. amzin7000

    amzin7000

    Joined:
    Nov 16, 2014
    Posts:
    48
    Yes we should (please link the thread here if you do make it) but i'm not sure how to prove it. We have to figure out what exactly in the phone's specs causes the issue. I know nothing about how phones work, so i have no clue what to look at.
    For all I know my Moto G has a slightly different graphics processor than the ones produced more recently and that is the reason for the lag and the reason unity never fixed it.
     
  12. studentvz

    studentvz

    Joined:
    Dec 14, 2014
    Posts:
    58
    I found that my main problem in Unity 5 is Terrain. Without it I can get stable 60fps, once I add Unity Terrain (3 textures, 700x700, pixel error 200, base map dist 400, legacy diffuse shader, no vegetation) it starts killing my phone, I can be satisfied if I can get 40fps. In Unity 4.6 it didn't have any performance hit.

    Problem is in shader, something is messed up since Unity 4. I tryed to assign regular Mobile/Diffuse shader to terrain and then performance was very good, 56-60fps. But because of this kind of shader all textures on terrain were blury.

    Publishing games that work on chopy 30/40fps in 2016, very bad...
     
  13. amzin7000

    amzin7000

    Joined:
    Nov 16, 2014
    Posts:
    48
    I don't use terrain, but canvases seem to do the same lag thing It could have to do with the shaders then.
     
  14. t-schulz

    t-schulz

    Joined:
    Feb 25, 2015
    Posts:
    13
    got very poor performance by upgrading unity from 5.3 to the newest 5.4. Got loading times like 6 times longer.... .... thats horrible.
     
  15. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    943
    I am experiencing the Canvas issue... cuts the FPS in half (even more)...
    Adding terrain in the scene with the lowest settings without any details does the same...
    Using vertex painted standard plane with mobile shader from a free VertexPaint tool from the Asset Store does the same as well. Using Unity 5.4.0p4

    The strange thing is that the problems show only on my Lenovo A6010 device with Qualcomm MSM8916 Snapdragon 410 CPU clocked at 1.20 GHz and Adreno 306 GPU
    But non of the problems seems to happen on my other device which has this CPU: Broadcom BCM23550 - 1.20 GHz as well

    NOTE: the canvas lag is a bit better when building under GLES 2.0
     
  16. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817
    some new experience:
    unity default sky box drop 20 fps on my test scene
    instead you can use Rock & Boulders similar sky box
     
  17. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817
    +
    Some image effects like Motion blur increase loading time very much
    first remove all image effects and test it again
     
  18. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817



    I finally remove all coins from scene and now create coins in Run Time and my frame rate now 60 fps and loading time is alot better
     
  19. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817



    Pixel shaders has a simple logic:
    Pixel shaders run on every pixel on screen. If your model is completely become visible in camera view and fill your screen , your shader run in 100% state. if your model hided 50% behind other models, your shader now compute 50% less.
    In your case because your terrain is fill a lot of your screen pixels,therefore your terrain shader is very important!!!
    you need very simple terrain shader and less than 4 splat texture for best performance.
    I use this tool for convert my terrains to model. my frame rate now 40-30% better!!!
    https://www.assetstore.unity3d.com/en/#!/content/47276

    you need custom optimized terrain shader for best performance

    Download Shader :
    Unity 4 (support 4 UV Tile) Link
    Unity 5 (support 2 UV Tile) Link





    Guide:
     
    Last edited: Sep 9, 2016
    xxhaissamxx likes this.
  20. amzin7000

    amzin7000

    Joined:
    Nov 16, 2014
    Posts:
    48
    Has anyone posted a bug report for this? Its something inside one of the shaders, but i can't replicate the UI slowness in a new project.
     
  21. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    943
    I've sent a bug report regarding the UI (Canvas) lag a few months ago (along with another issue):
    https://fogbugz.unity3d.com/default.asp?797155_te5q9gn44fnm2qet - now the case is closed.
    The answer from unity was that they are not able to reproduce the issue (unlike the hundreds of people having trouble with that !)
    Don't know about you guys but i am stuck :) !
     
  22. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    943
    Hey guys, after whole day spent in investigating the UI performance issue i manged to get a game running from 20FPS at stable 60FPS on a Lenovo phone...!

    Some very strange thing was made the FPS to drop down quite a lot on this device with Adreno GPU... (This should be a GPU issue as the CPU in the profiler shows more than 60FPS )
    So the first issue - almost every time i am adding a canvas to the scene i am adding a Panel stretched to the whole canvas and then all the elements added as children to it... and believe it or not this panel was making the FPS to drop by 25-30 % ( from 60 to 45 and even more)... My game is 2.5D and the camera is looking down all the time (this is important)... For some reason when i have the camera looking up and not many objects are behind the canvas, the FPS is high when having an image stretched to the canvas... but let's say the camera looks down to the ground again, the fps drops down... After i removed all of these stretched images, the FPS went up to more than 50fps... This is really strange to me because does not happen to another device i am testing on (which is gles2.0)! With all that, i had a plane with shader for Vignette effect (mobile ready from the asset store!) which was the second culprit for the bad FPS... The effect by itself does not hurt the performance, but when some objects are behind it the FPS gets low instantly...! This shader doesn't hurt the FPS on the other device that much... so a bit strange again! However the first thing i mentioned was the main problem!

    I guess the low FPS was because of the current hardware in my device or that Unity is not optimized for that hardware - not sure... As i know many many devices have the same hardware...

    So, hope someone will find this helpful !
     
    Last edited: Sep 15, 2016
    elias_t and LightingBox2 like this.
  23. r-pedra

    r-pedra

    Joined:
    Dec 4, 2015
    Posts:
    104
    This is causing Overdraw. Overdraw is when the GPU needs to draw multiple times one pixel to render the frame. It happens on transparent things and very often with UI.
    Maybe this is a bug in the Lenovo GPU that is not supporting well many overdraws.
     
    JamesArndt likes this.
  24. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    943
    Was just a plane with mobile diffuse shader and the Canvas running at about 40 FPS because of that stretched image... Disabling it solves the FPS drop even though there was plenty of other UI Elements non of them stretched to the whole canvas...
    Might be hardware related issue or lack of optimization for that current hardware on Unity's side... Really don't know!
    Just mentioned that in case someone decides to try if solves any problem :)
     
  25. DeXoN

    DeXoN

    Joined:
    Feb 10, 2013
    Posts:
    27
    This is what I was afraid of. Support for all these new platforms took away from the necessary resources to flush out bugs and platform specific issues. I'd have been happier if Unity stayed with Mobile & PC and even happier if Unity 4 could've lived longer.

    One question though. I see everyone mentioning Unity 4.6x and not 4.7x? Is there any reason not to go to 4.7.2f0, which is the latest?
     
    Last edited: Sep 16, 2016
  26. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    635
    Did the fullscreen panel itself have an image on it? A panel is just a Rect transform with image attached really, so why do you need a full screen image?
     
  27. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    943
    Some of them had a black color with alpha set to about 0.5 - this way you can isolate (darkening) a dialog or another menu from the background and some of the rects had the alpha currently set to 0 just because i was testing different color schemes!
     
  28. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817


    I use 4.7
    Some people do not know unity 4.7 has been released. Unity is told by email 4.6 is latest version of unity 4
    Unity 4.7 is the most complete version of unity so far.
    I could not find even a simple bug on Unity 4.7!!!

    With some changing on shaders, my scene now looks like unity 5 in unity 4 :
    Main different is Rim lighting
     
    Last edited: Jul 10, 2017
    Vagabond_ likes this.
  29. DeXoN

    DeXoN

    Joined:
    Feb 10, 2013
    Posts:
    27
    @aliyeredon2: You and I are on the same page. I believe 4.7 is the best version of Unity to date.
     
    JamesArndt and LightingBox2 like this.
  30. amzin7000

    amzin7000

    Joined:
    Nov 16, 2014
    Posts:
    48
    Unity can't replicate the bug because it only seems to happen in projects made in some earlier version of unity and now being used in the most recent version of Unity. Like I said, I tried replicating the canvas bug by using a bunch of canvases in a new project and they didn't lag anything or cause any issues.
     
    MrEsquire likes this.
  31. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Yes and this is what I keep saying, its important to say which version of Unity one uses as each one has different performance. They not going to test on older versions because they do not support them anymore. 4.6x is not supported anymore of course it was not left bug free. So hence if your using version 5 of unity we on 5.4 already and if one is making for mobile just read the change logs the amount of changes, and UI has evolved throughout.

    Not sure why some people think magically old version of Unity will get a specific fix, only thing that get fixed is maybe Xcode 8 support for 4.7x etc otherwise each new bug found is pushed into 5.4x and 5.5Beta with some things only be fixed in 5.5..
     
  32. GerardQ

    GerardQ

    Joined:
    Oct 15, 2011
    Posts:
    38
    @Vagabond: I've posted elsewhere in this forum about the problems I saw with Qualcomm Adreno cards. The first thing to know about them is that they're apparently not fully backwards compatible with GLES 1x prior to GLES 2.0. Secondly, Unity itself will complain about any alpha testing in custom shaders and report that it might produce problems with Qualcomm Adreno - so Unity knows something about the issue. (Coincidentally, Alpha testing is now also a legacy topic in the Unity 5 shader reference). However, I found that custom shaders with alpha testing still worked as expected on these cards - but with a significant frame rate drop. (BTW alpha testing is typically used in cutout transparency and I used alpha testing to my advantage in my own custom shaders specifically because it utilizes the depth buffer). I also found that the frame rate drop is very sensitive to more complex objects in the scene - so vertex count matter a lot - even without transparency in the meshes.

    I suspect that the hardware incompatibility in a card like Snapdragon 410, is compensated for in software (i.e. shader compiler) but at a cost in performance. Maybe, just maybe this issue also carried over into the UI system in Unity 5 whenever there are transparent panels. In other words, the problem of crashing has been solved, but it runs slower. I would also not be surprised if Unity is restricted under a gag stipulation not to divulge this information to the rest of us, which is why earlier posters could not get answers out of Unity. Keep in mind this last paragraph is all just guesswork on my part though.
     
    Vagabond_ likes this.
  33. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    943
    Unity 5 is like much better now for Desktops and not that much for mobiles anymore...
    Feeling more like you are fighting to it instead of using it... which is kind of cool - learning more stuff that way :) !
    More and more people are starting to experience more and more difficulties with every next major release...
     
    GerardQ and LightingBox2 like this.
  34. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817
    Unity fog system after 5.2(or maybe 5.3!) has a big frame rate problem:

    this is my last test with ES2 & ES3 on 5.3.4 - 64bit

     
    Last edited: Sep 20, 2016
    MrEsquire likes this.
  35. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    943
    Looks like everything is broken...

    i used Snapdragon prifiler to track the GPU work and this is what happens... I really can't read exactly what all that means because i am not aware of the graphics pipeline that much... But you can see clearly that the "eglSwapBuffers" takes much more time than before enabling the terrain (which is same for canvases)...
     

    Attached Files:

    LightingBox2 likes this.
  36. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817



    Can you test it with a terrain model instead of unity builtin-terrain?
    Of course with the same shader test
     
  37. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    943
    Do you mean with a mesh terrain imported from some 3D application ? If so... i did test and you know what... no matter what i am using for a ground(mesh or a terrain) in my case it came down to the shaders i am using...
    It is all the reflections. They was actually cutting the fps down to a half...
    I amusing now a two texture blend per vertex with normals and the fps ~ 60. but if i just ad specular reflections to the shader - goes down to 30 fps... Using a terrain with a mobile diffuse shader gives me high fps as well...
    So in my case any kind of reflections seems to be the main problem... which is sad while the same texture blend shader with specular works just fine on iPad Mini2 at high fps...
     
  38. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817
    You want add specular to mobile terrain. yes?
    Do you test it on unity 4?
    I test some advance shaders on both 4 & 5 and understand both performance is same. I am sure now. unity 5 shader performance is same as 4. but has some limitation on texture sampler count on mobile shader model 3 or 2. But in unity 4 you can use 2 more sampler!!!
    I write new shader with specular and cube map in unity 4. performance is good. but in unity 5 i have some limitation on texture samplers.
    Cubemap has very good performance but specular is not very good on mobile terrain(because computed in lighting section)
    This is 3 splat and 1 cube map terrain shader

     
    Last edited: Sep 20, 2016
  39. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817
    New test:
    With Unity terrain => 54.000 Tri => 40 fps (165 draw call)
    With converted terrain to model => 65000 tri => 50fps (135 draw call)
    same shader,same view (3 Splat,1 cubemap, unity 4, Lenovo a3500,mali400MP)


    Terrain model => 3 Splat, 1 Specular => 50fps
     
    Last edited: Sep 20, 2016
  40. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    943
    I am always using the latest unity and never going back even on patches...

    I'm having problem even with the mobile bump spec shader... really don't know what to think!

    EDIT: I think on different hardware there is a couple of things at once that are ruin performance...
    I remember that Unity is doing an additional "Blit" on android which might still be the case or part of the issue...
     
    Last edited: Sep 20, 2016
  41. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817
    I also use unity 5 for asset release. but for game release Unity 4 is better choice for me
     
  42. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    635
    What are the two screenshots showing? Without and with fog?
     
  43. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817
    Yes. I also test on real game. same result. but in unity 5.1.x frame rate is same as unity 4 fog.
     
  44. Vagabond_

    Vagabond_

    Joined:
    Aug 26, 2014
    Posts:
    943
    Hi, something else i wonder if you are experience as an issue !
    I wonder if have to Submit a bug report or something is wrong with my project !!!

    Now i am using 5.4.1p1 and i think this is happening since 5.4... (not sure)
    When i build the project which is not big at all... it takes about 40 minutes to build...
    This is mostly happening if i've made some changes to scripts...
    The first time i build after some changes were made or switch to another platform, the build always takes about 40 mins. but then if rebuild again right after that... it's much faster...
    It's happening on Android, iOS and i think even when building for Win Standalone ...

    It hangs on these two stages for quit a long time - 15-20 minutes for each...
    It just took about an hour to build... So anyone is aware if that's a bug or something...

    Building_Progress_1.png

    Building_Progress_2.png
     
  45. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    635
    Thanks I'll have to test that out myself on Unity 5.4.
     
  46. obses

    obses

    Joined:
    Jan 23, 2016
    Posts:
    7
    Anything new on this? Several months ago I've upgraded my 5.2.3 to 5.3 >>> fps fall on android from 60 to 10; later I've found on forums that this is a bug so I went back to 5.2.3.
    Today I've decided to upgrade to 5.4 because some assets in store required it >>> fps on android (same mobile, same game) fall from 60 to 32...Someone found out a way to fix it, not going back to older version?
     
    JamesArndt likes this.
  47. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817
    Last edited: Oct 23, 2016
  48. Azmar

    Azmar

    Joined:
    Feb 23, 2015
    Posts:
    246
    This is a very useful guide! I feel like a lot of questions on performance were actually answered in earlier posts, heck I gave an answer on how unity terrain easily destroys performance on mobile like a year ago and how to make it manageable. Maybe someone should start a new thread and create a nice visual post with everyones suggestions gathered from entire thread so we can move onto finding new performance increases without become repetitive on saying the same thing? It really is hard to find answers in this thread...

    I know how frustrating it is to have horrible fps and can't figure out why, and a lot of of people's suggestions don't actually seem to fix it. But terrain in my case literally changed me from 10fps to 60fps. If you still have horrible fps and don't have unity terrain, next big one is uGUI with your canvas mode and how many canvases. Should only have 1-2 canvas active at once, and draw calls need to be like 20 or lower. Any other changes that I tried throughout entire thread like quality settings seems to be minor fps increases (1-2) or none at all, but I guess they do add up.
     
  49. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817


    I used only one canvas in all type of the games. Why do you need to use more than one Canvas?
     
    Last edited: Oct 24, 2016
  50. LightingBox2

    LightingBox2

    Joined:
    Mar 31, 2015
    Posts:
    2,817
    My game performance improved after baking light map on Unity 5.4.1
    I understand that performance is same as unity 4 can do.
    Edit: New test with fog added.
    * Terrain shader : legacy diffuse
    * trees : billboard
    * Tri : 60.000
    * canvas items : 30+
    Screenshot_2016-10-24-21-26-51.jpg
    Screenshot_2016-10-24-21-24-43.jpg
    Screenshot_2016-10-24-21-56-18.jpg
     
    Last edited: Oct 24, 2016
    JamesArndt likes this.
unityunity