- Home /
adding and playing animation clips in code
Hi,
I want to add the animation clips to a character programatically since they keep going missing whenever we do an update from the asset server! Crazy!
I've tried clearing the array in the inspector then doing this:
animation.AddClip(animation.clip, "Male_Walk");
which adds the clip to the array (I can see it in the inspector) but it will not play.
I've also tried doing this:
AnimationClip[] animationClips = new AnimationClip[1];
animation.AddClip(animationClips[0], "Male_Walk");
AnimationUtility.SetAnimationClips(animation, animationClips);
But that doesn't seem to set the array at all (nothing in the inspector)
What am I doing wrong?
Thanks
Answer by demize2010 · Mar 31, 2011 at 11:37 AM
animation.Play("Male_Walk");
not working?
I know this is an old thread, but I just had this problem and realized I was expecting this to work when my Time.timeScale was set to 0. Not going to happen. Anyone else having this issue can use this approach to animate independent of timeScale, http://answers.unity3d.com/questions/217351/animations-ignore-timescale.html
Your answer
Follow this Question
Related Questions
Play Animation File 3 Answers
How can we procedurally animate GUIText.fontSize? 1 Answer
Play animation if Player is close within certain distance. 1 Answer
AnimationClip must be marked as Legacy 0 Answers