call animation functions from other object

hi, I dunno why the heck this doesn’t function? Actually I did always do it this way with any other Components etc… ?
This is the Code where I try to play an Animation from another object after a mouse-collision… :

Would be great if I could do it with one line like this

Hmm… the code you posted shouldn’t even compile, because you’re calling Play() on a object of type Component.

So first up it should be

[B]Animation[/B] PlayIt = PathAnim.GetComponent<Animation>();

PlayIt.Play();

What exactly is going wrong? Is it just not playing the animation? Or is it throw exceptions (errors) that say stuff like ‘’ xxx does not contain component of type yyy"?

And assuming that assuming that the GameObject associated with the Transform PathAnim contains an animation component which has an animation defined as Take 001, you should be able to do what you wrote at the bottom. Namely…

PathAnim.GetComponent<Animation>().Play("Take 001")

it worked fine now with the code you provided… thanks Dude!