- Home /
Add animation clip to animation Component?
Hi guys, quick question: (I looked for it but could not find anything)
I have a ton of objects and I need to add one animation to each, so instead of going one by one adding the Animation Component I just did it via Script:
//Add animation component to every object
var objComponent;
objComponent = gameObject.AddComponent ("Animation");
So now I want to add the an animation (the same for all) to every anim component. I cant get it working, i know it would be using AddClip. Can someone give me an example of how to do this?
Thanks everyone :)
Comment
Just call AddClip and pass your clip. Which part doesn't work?
You have to pass the animation-clip's name as 2nd paramter. $$anonymous$$g. animation.AddClip( animationClip, animationClip.name ); I think that's what Unity is doing
Your answer
![](https://koobas.hobune.stream/wayback/20220613082221im_/https://answers.unity.com/themes/thub/images/avi.jpg)