0

So I have been trying to find a way to write code that would allow you to load an animation clip from a folder and apply it to a character using animationcontrolleroverride.

I got it working when I loaded the animation clip from the resources folder. but the problem is once you build, the resources folder stops importing anymore (as far as I am aware)

After that, I tried loading using the assetbundle method. But I keep getting a null reference error saying that the assetbundle is empty. here is my code:

    WWW animationfile = WWW.LoadFromCacheOrDownload(directory,1);
    yield return animationfile;
    AssetBundle bundle = animationfile.assetBundle;
    AnimationClip animClip = bundle.mainAsset as AnimationClip;
    print(animClip.name);

The print always displays a null error. I am not sure what I am doing wrong. Also if anyone has any suggestion for dynamically loading using another method, please let me know.

Edit: Because this question was marked as a duplicate, I feel I need to make my question more clearer.

I know that Resources.load allows you to load from the resources folder, but does that still work in an actual build? Because I couldn't get it to work when it was in build format. I only got it working for editor format.

Other than that, I am not quite sure why the assetbundle method is not working and I am not sure what kind of error it is.

  • The `Resources` API is used to read data in the Resources folder. See duplicate for examples. – Programmer Oct 05 '17 at 22:26
  • Yes, the resources stuff should also work in a build. Don't just say "it doesn't work".Add EDIT to your question then post a screenshot of where you put the file and your new code that doesn't work. – Programmer Oct 06 '17 at 07:19

0 Answers0