• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Noah-1 · Oct 12, 2012 at 03:14 AM · animationaddclipmassive

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
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Paulius-Liekis · Oct 15, 2012 at 01:41 PM 0
Share

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

avatar image JanWosnitza · Oct 16, 2012 at 05:18 PM 0
Share

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

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

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

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can I make animations snap to a frame? 2 Answers

Issue with Animation.AddClip() firstFrame lastFrame possibly bugged. 0 Answers

Not playing whole animation 0 Answers

How to select an animation clip by index number? 7 Answers

Animation.AddClip() copies the clip? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges