Search Unity

Low game performance in Android

Discussion in 'Android' started by Klik303, Jan 7, 2018.

  1. Klik303

    Klik303

    Joined:
    Dec 10, 2016
    Posts:
    19
    Hi.
    I have made my first game for Android and I'm very disappointed about performance.

    I tested this game on two devices - Motorola Moto G 3rd Gen and Samsung Galaxy Tab 4.

    When I launch this game on:
    Moto G in "Main Menu" - 30FPS, in game 120FPS.
    Tab 4 in "Main Menu" - 13FPS, in game 23FPS.

    So as you can see in Moto G there is no problem but problem is in Tab 4. That results shocked me.

    I know, Tab 4 is not the most powerful device but I can play on it all "Angry birds".

    So why "Angry bird" works so good but my game is so bad on Tab 4?

    My game is simple 2D game when you have to roll a ball on board using accelerometer. There is only a few objects on board with colliders, simple background as a sprite and ball.

    So I don't really understand why performance is so bad.

    I followed documentation about profiler and how to boost performance but no success.

    All screens come from Moto G. I can't run profiler when I run game on Tab 4.

    Profiler in "Main Menu":

    test.jpg

    Profiler during Game:

    inGame.jpg

    Quality settings.
    qua.jpg

    As you can see I changed quality to min but it didn't do any difference. Why?? Even the game looks the same.

    I don't know what else I can do to improve performance.

    Please help.
    Thank you.
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,726
    Shot in the dark here, but you're probably fillrate bound (especially in the menu scene).

    If you decrease resolution does the performance increase?
     
  3. Klik303

    Klik303

    Joined:
    Dec 10, 2016
    Posts:
    19
    Do you mean texture resolution?
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,726
    No, I mean the resolution your game runs at.
     
  5. Klik303

    Klik303

    Joined:
    Dec 10, 2016
    Posts:
    19
    Where can I change it? I only set canvas reference resolution to 1920 x 1080.
     
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,726
  7. Klik303

    Klik303

    Joined:
    Dec 10, 2016
    Posts:
    19
    Yes, when I decreased resolution then game works faster but look awful :(
     
  8. kalineh

    kalineh

    Joined:
    Dec 23, 2015
    Posts:
    241
    Everything is just really slow on phones, the overhead of unity design and C# in general make simple tasks slow. You'll probably have to tackle a lot of small things to get the performance reasonable.

    Looking at your profiler I would guess you have too many draw calls (100~ is about the limit) so try improving batching (static+dynamic), replace shadows with none or blob shadows, and remove every transparent render object you can find. Use the frame debugger to see what's being rendered. You can reduce the resolution about 10% to get a little saving without noticing much (maybe close to 20% if you use antialiasing too).

    Check your shaders are using mobile variants of built-in shaders. Check you have no really heavy pixel shaders for large screen-space objects. You can usually replace your background with a custom simple shader that's very simplifed.

    Check your particle effects - never use 3D noise (1D if you really need it). Try to get all your static effects in local space and remove that little warning bubble (top right of inspector on particle effect, it will tell you why it is must do per-frame culling calculation, try and fix those).

    SkinnedMeshRenderer is slow, avoid it if possible (or use LOD to have non-skinned versions for far away meshes). Ensure animators are set to cull completely when offscreen. Reduce bone counts where possible and simplify transform hierarchies if possible.

    Check your texture compression for android build - make sure you're using one of the compressed formations and limit the size of assets to something smaller than PC. Check the import settings on each asset. You won't need full-resolution for most 3d world textures on mobile (you'll save a lot of final build space too).

    Check your asset compression - use ADPCM for effects and mp3/vorbis for music. You can probably use mono audio for a lot and reduce bitrate a little. PCM can be a little faster but will use much more space.

    Canvas is /really/ slow. Avoid it at all costs if you can. If you must use it, put all your static/stationary things on one canvas, and moving things on another one. If you move anything, all objects on that canvas must be updated, so split them up. We internally ban all canvas use.

    Check your physics timestep update, you can probably increase it and reduce the number of iterations. Check your objects are not using too much continuous collision detection.

    Remove mipmaps on your menu graphics, you won't need them. Remove read/write flag from 3d models and enable compression.
     
  9. Klik303

    Klik303

    Joined:
    Dec 10, 2016
    Posts:
    19
    Can you tell me more about this or refer me to some guide?

    So how to do button, lists, static background or text if I shouldn't use canvas?

    Thank you.
     
  10. kalineh

    kalineh

    Joined:
    Dec 23, 2015
    Posts:
    241
    Try these:
    http://blog.theknightsofunity.com/mobile-optimization-batching-unity/
    https://developer.oculus.com/blog/squeezing-performance-out-of-your-unity-gear-vr-game/
    https://unity3d.com/learn/tutorials/topics/virtual-reality/optimisation-vr-unity

    (some are VR articles, but they are still showing useful info for optimization).

    As for canvas, you can manually place 2D SpriteRenderer objects, and handle buttons and stuff manually. It depends how complex your UI is. If you're just showing a simple high score and name or something, it's easy enough to change. If you have a very complex UI with buttons and panels and lists and stuff you'll probably have to just leave it.
     
    Yamin-Nather likes this.