- Home /
How to target a gameobject in C# to play animation
I have a script attach to my Character but i want to make the enemy play an animation from that script, so i think i should target the game object (or the enemy) and play its animation on my character script but the problem is i dont know how to do it so please help me thank you
You might want to do some google searches for how one script can talk to another.
Can you not add an enemy animation though? I'm confused as to why the enemy would play someone else' animation.
Or, when the character does something, the enemy plays one of his own animations? (EX: Character laughs at enemy, enemy gets mad and plays Get$$anonymous$$ad.animation)
Answer by Fr0stbite · Feb 04, 2014 at 07:06 PM
If i understand your question:
enemy.animation.Play();
Answer by NDJoshi · Feb 04, 2014 at 02:55 PM
You can give the character script to enemy script by giving the referance of the character..
And insert conditions on which the animation should play...!!!