Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Downloading animations from server at runtime and using it.

Discussion in 'Getting Started' started by akshay_shah, May 4, 2018.

  1. akshay_shah

    akshay_shah

    Joined:
    May 19, 2017
    Posts:
    16
    Say for example, I have my app ready with few animations.
    Now, is there a way I could code so that, I could create .fbx animation files and keep them on server.
    Now my app would download them at runtime next time when the app starts and use those animations.
    Is this possible?

    I checked related to it and found AssetsBundles can be used for downloading and using contents at runtime. But could not determine if animation fbx files could also be downloaded and used at runtime using AssetBundles.
    If not possible, any other way to achieve it?

    Any help is appreciated. Thanks!
     
  2. akshay_shah

    akshay_shah

    Joined:
    May 19, 2017
    Posts:
    16
    Bump.. Any help?
     
  3. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,365
    Other than scripts you can store anything you want in an asset bundle.
     
  4. akshay_shah

    akshay_shah

    Joined:
    May 19, 2017
    Posts:
    16
    Thanks for your reply.
    I am successfully able to store the animations in assetbundles, store it on server, download it and retrieve the animationClips from the asset bundle.
    However, I am not able to find a way to set those clips for the animations states in my animatorController.

    For example, say I have states - state1, state2 and state3 in my animatorController. Now, after downloading clips from webserver, I want to do something like this at runtime:
    state1.animationClip = myAnimClip1;
    state2.animationClip = myAnimClip2;
    state3.animationClip = myAnimClip3;

    But cannot find a way to reference the states. The only way I find is using classes in UnityEditor which will not be available at runtime.

    Any idea on how can I do that?
     
  5. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Have you tried putting the AnimatorController in the asset bundle as well?
     
  6. akshay_shah

    akshay_shah

    Joined:
    May 19, 2017
    Posts:
    16
    Yes, I thought of that approach, but then, for every new animation added, I will download all of them again. and I want to avoid re-downloading all animations for a single new one.