which animation is playing

This question was asked by someone else but never answered. How do you tell which animation is currently running.

Let’s say I have

cow1.animation.Play(“walk”);
or
cow1.animation.Play(“run”);
How can unity tell me which animations is running.

what command would give me back
“walk”

Dan

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.

Dan