getting animation component

Hi , i want the animation component from a object. How can i get it ?

object.GetComponent(Animation).animation[“run”];

this doesnt work

Hi bumba, i’m probably not the best person to reply, but maybe I can help…

I actually haven’t understood very well what you want to do. If you need to play the animation of an object, from a script placed in another object here is the solution, otherwise what do you mean for Getting an animation?

So in the script you want use to “recall” the animation :

 var yourObject : Transform //this is the object wich contains the animation

// then wherever you want, you execute the animation with:

yourObject.animation.Play() //or whichever animation function you need

hope this has been usefull…

1 Like