Search Unity

Playing hundreds of animations on mobile

Discussion in 'Animation' started by DroidifyDevs, Dec 6, 2016.

  1. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    Hello!

    So lately I've wanted to look into my animation management skills, as well as optimization for mobile. Currently, I have soldiers walking in a line, nothing special. On mobile, I can get up to 30 before the FPS becomes unplayable. Here's what I've done so far to optimize them:

    • Simplified Skinned Mesh Renderer.
    SkinMeshRenderer.PNG
    • Optimized model
    SoldierImport1.PNG

    • Optimized the Animation's rig
    SoldierRigImport1.PNG
    • Added more room for animation errors:
    SoldierAnimation.PNG

    And here's the profiler (sorry for my obnoxious blue play mode color; it keeps me notified though):

    Profiler1.PNG

    Which makes me wonder, why are the Animators's Update, FixedBehaviourUpdate (Animator update mode is "Animate physics") and MeshSkinning so high after all the optimization I've done?

    Sorry, I haven't worked much with animations. Are there some optimization steps I missed? Is it even possible to have dozens of animations on a mobile platform?

    I've noticed that all mobile games I know of have only a few animated characters in each scene. I've never seen a mobile game with an army of hundreds of soldiers. I'm starting to think that I'm simply pushing mobile too far.

    Any ideas on what I could do better? Thanks.
     
    XCO likes this.
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Looks like you have optimized pretty tight. (1 bone interpolation setting. Wow!)

    One thing as to why these readings might be high might be from bone count. When reading the docs they still suggest lowering the bone count as much as possible for mobile.
    Other optimization tactics could include smaller/shared textures and lower polygon count, but I doubt these have any effect on Animators's Update, FixedBehaviourUpdate (Animator update mode is "Animate physics") and MeshSkinning, except bone count and poly count for MeshSkinning.
     
  3. aer0ace

    aer0ace

    Joined:
    May 11, 2012
    Posts:
    1,513
    Animation was the largest impact on performance on Horde Rush (see sig) as well. So much so, that I had to reduce the number of attacking monsters at any one time, and disable animation for monsters that were outside a certain radius. I also explored updating animations on a schedule (i.e. throttle to every other frame for some monsters), but I don't think I ever found a solution that wouldn't require me to implement (or re-implement) existing functionality. One thing I remember doing was reducing the number of keyframes in my animations. And, when the monsters aren't attacking, I put them in an idle state, with just a handful of keyframes in it.

    I would have wanted to reduce the number of bones in the Blender Rigify rig, but I knew it was going to be a ton of work that can potentially result in bad data. For example, the Rigify rig has 2 bones for both the upper arm and lower arm (and upper leg and lower leg, I think). I don't think this is necessary, and I wish there was an option to remove this. Even then, I wouldn't be too sure about the improvements, because while there were extra bones in the rig, it didn't reduce the number of transforms any.
     
    DroidifyDevs likes this.