- Home /
Can't Instantiate AnimationClip from AssetBundle correctly
It doesn't work when I tried to Instantiate AnimationClip from AssetBundle.
Details;
Get AnimationClip data from AssetBundle.
Duplicate AnimationClip using Instantiate().
Overwrite AnimationClip of Animator with duplicated AnimationClip.
Animation does not work without any error logs (animation should be played according to overwrote AnimationClip)
If I instantiated AnimationClip from resources which loaded via Resource.Load, it works fine. directly getting an instance from Resource.Load is OK as well.
AnimationClip From AssetBundle.Load -> OK.
AnimationClip From AssetBundle.Load with Instantiate() -> "NG".
AnimationClip From Resources.Load -> OK.
AnimationClip From Resources.Load with Instantiate() -> OK.
What is the difference?
If samples is needed, it is ready.
my environment is as follows;
MacOSX: 10.12
Unity: 5.4, 5.5 (checked in each version)
Unity Editor: MacOSX
Test scene : Assets/TestScene.unity (A Cube's animation is override in each cases.)
Test script : AnimationClipTest.cs
I have the exact same problem. I would like to know whether your asset bundles placed inside Unity Project? I have tested get all bindings and corresponding curve from the AssetBundle AnimationClip. However, I could not get any binding. Therefore I have a hypothesis that the Instantiate function and other Editor function that can grab the AnimationClip Info is to find the original file as asset bond with the AnimationClip. As my AssetBundle is outside the project root path, so those approaches can not access to the asset info and reproduce another one.