x


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 :)

more ▼

asked Oct 12 '12 at 03:14 AM

Noah 1 gravatar image

Noah 1
1.1k 33 45 50

Just call AddClip and pass your clip. Which part doesn't work?

Oct 15 '12 at 01:41 PM Paulius Liekis

You have to pass the animation-clip's name as 2nd paramter. E.g. animation.AddClip( animationClip, animationClip.name ); I think that's what Unity is doing

Oct 16 '12 at 05:18 PM JanWosnitza
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3806
x5
x3

asked: Oct 12 '12 at 03:14 AM

Seen: 397 times

Last Updated: Oct 16 '12 at 05:18 PM