Search Unity

Animation Override Controller and Asset Bundles (iOS)

Discussion in 'Editor & General Support' started by AllanMSmith, Sep 12, 2017.

  1. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    Hey,

    So, I am developing a pretty considerable sized mobile game and we are just now implementing asset bundles to try and reduce the initial size of the game on the App Store and Google Play. Its been a whole lot of work porting the whole game to use asset bundles, almost 2 months, but I think finally we are getting to the end of it.

    We are using On Demand Resources for iOS and a CDN for Android, so the systems probably have some internal differences in regards to how xcode handles things vs simple web requests on Android... but there is something I just dont understand happening. We have an Animation Controller, which has Override Controllers. Both the Animation Controller and the Override Controllers are all in the same asset bundle, together with all the animation clips that they use. If I drag the characters model to a scene (which is also loaded from another asset bundle), make 2 copies of it, one using the Animation Controller and one the Override Controller (even if with the same clips), the one with the Override Controller does not animate. No scripts attached, nothing, just the model with the Animation Controller or Animation Override Controller.

    I would guess that this is an Unity bug, since there is absolutely nothing of our pipeline involved with this, but I could be wrong. Btw, using Unity 2017.1.0 and just tried with Unity 2017.1.1. Also important to notice is that this does not happen on Android (same configuration of asset bundles, but using a CDN instead of ODR), and doesnt happen on Editor either, only when testing on the device.

    Anyone run into similar issues? Is this really a bug? Is there some way around it other than NOT using Override Controllers and duplicating the whole Animation Controllers and changing references?

    Thanks,
    Best,
    Allan
     
  2. Santy

    Santy

    Joined:
    Apr 16, 2013
    Posts:
    26
    I'm facing the same problem: I've got in my asset bundles the game objects with animations and they work fine on Android, but when I run the App on iOS device animations don't work. Animator.Properties return an empty array, and I don't know how to solve the problem.

    Help please: I need to publish the app next week and I am stuck.

    Thank you in advance!
     
  3. AllanMSmith

    AllanMSmith

    Joined:
    Oct 2, 2012
    Posts:
    180
    Man, I'm really trying to remember what we done... there were sooo many things we tried out... I know we got it working now, with override controllers, but I can't remember what exactly did the deed... if I remember correctly it had something to do with the "binding" of the animator controller... we were doing something that was necessary before, but apparently was breaking the game now.

    Well, here is our code either way, and this is working, its actually pretty simple:

    Code (CSharp):
    1.             FHAssetManager.LoadAsset<RuntimeAnimatorController>(bundle, animatorName, animatorController =>
    2.             {
    3.                 // BossAnimator can be null if we changed boss for hire while loading
    4.                 if (BossAnimator != null)
    5.                 {
    6.                     BossAnimator.runtimeAnimatorController = animatorController;
    7.                     BossAnimator.applyRootMotion = true;
    8.  
    9.                     FinishEquippingItem();
    10.                 }
    11.             });
    We made our own asset bundle manager because Unity's is one of the most confusing code I've ever seen... but the usage is similar so we are only downloading the bundle if necessary, getting the asset and returning it to the callback.

    I hope that helps at least a little!
    Best,
    Allan
     
  4. Santy

    Santy

    Joined:
    Apr 16, 2013
    Posts:
    26
    Thank you very much Allan. I'm going to try and will tell you if I got it or not.

    Thank you for your very fast response!