- Home /
C# - Reference Animation Component from a different script
So I am still a bit noobish in the vast world of Unity. I believe I have a small problem. I am trying to call a set animation from the Animation Component via a different script here is the line of code that i am trying to use.
animation.Play ((GetComponent ().animation[attack1AnimationNum]));
Can anyone help me?
I don't think that is possible. I suppose you want a character to mimic other's animation. The nearest I can think of is by adding a clip in runtime and play that. animation.AddClip() and animation.RemoveClip() can add/remove a single clip. That should help you on the way.
Answer by LT23Live · May 02, 2015 at 01:30 AM
to answer my own question just incase anyone ever looks for such a wrong thing. the animation name must be a string
Your answer
Follow this Question
Related Questions
2D Animation does not start 1 Answer
Animation Component must be masked as Legacy - Animated made internal 0 Answers
Animation not showing but running 0 Answers
Access Animations array in Animation component 1 Answer
About animation event! 0 Answers