Question by
CherryPicker · Jun 03, 2016 at 04:16 AM ·
animationscripting problemanimation clip
Can't attach animationClip to animation
I manage to get an animation clip from my animator.
But when I try to attach the animation clip to the animation it fails !
I am not sure why
public AnimationClip GetAnimationClip(string name)
{
if (!anim)
return null;
foreach (AnimationClip clip in anim.runtimeAnimatorController.animationClips) {
if (clip.name == name)
return clip;
}
return null;
}
This part works fine, as evidenced by the following
Here is the part that fails
if (ready) {
for (int j = 0; j < 9; j++)
{
if (player1Attacks [j] == 1) {
animationClip = GetAnimationClip("Armature|HAttack1");
animation.AddClip(animationClip, "HA1");
animation.PlayQueued ("HA1", QueueMode.PlayNow);
}
The " animation.AddClip(animationClip, "HA1"); " is the part that is failing.
As you can see from the image above, the animation clip is found but it does not manage to attach to the animation.
Why ?
Comment
Is there a reason you aren't using an Animator Controller?