var currentAnimation:String;
function string whichAnimationIsPlaying() {
if (animation.IsPlaying("walk")){
return "walk";
}
if (animation.IsPlaying("run")){
return "run";
}
}
function Update(){
currentAnimation = whichAnimationIsPlaying();
print(currentAnimation); //prints walk or run
}
That’s a nice solution. But I don’t want to write if then statements for 30 animations for 10 animals. There should be an elegant way to query the current animation’s name from the animation component.