Search Unity

AnimationClips from fbx in Assetbundle not correctly loaded/playing

Discussion in 'Animation' started by Sejadis, Dec 6, 2017.

  1. Sejadis

    Sejadis

    Joined:
    Jun 24, 2015
    Posts:
    20
    Hi there,

    i'm trying to load animation clips from an imported fbx file which i get via assetBundle.

    basically this code:
    Code (CSharp):
    1. AnimationClip[] clips = bundle.LoadAllAssets<AnimationClip>();
    2. foreach (AnimationClip clip in clips
    3. {
    4.     clip.legacy = true;
    5.     clip.wrapMode = WrapMode.Loop;
    6.     anim.AddClip(clip, clip.name);
    7. }
    and then calling it with:

    Code (CSharp):
    1. anim.Play("nameHere");
    will do nothing

    if i put the fbx in my resources folder and load the clips with this instead:

    Code (CSharp):
    1. AnimationClip[] clips = Resources.LoadAll<AnimationClip>(s);
    everything works fine
    clips from both sources return false for clip.empty and the length from both sources is the same.

    i haven't seen a property to directly see the curves so i didn't compare those

    as for building the asset bundles im using BuildAssetbundleOptions.None as the only 2 that seem relevant are .CompleteAssets and .CollectDependencies which are both deprecated as they are now standard

    As far as i can see the only 2 sources for problems could be building the bundle and loading from the bundle

    Any help appreciated!
     
  2. mynamepfd

    mynamepfd

    Joined:
    Jan 4, 2016
    Posts:
    19
    Make sure fbx and clip are legacy, and clips are extract from fbx?
     
    Sejadis likes this.
  3. Sejadis

    Sejadis

    Joined:
    Jun 24, 2015
    Posts:
    20
    Yes, importing the FBX as legacy did the job