Check to see if animation is playing

Hey guys, I want to check if the animation is finished playing then destroy the game object.

	public void KillEnemy(){
		//state = state
		enemyIsDead = true;
		state = State.FLEE;
		combatState = CombatState.LOSE;
		animation.Stop();
		Debug.Log(state);
		animation["death"].layer = 2; //all animations start at 0.
		animation["death"].wrapMode = WrapMode.Once; //jump once
		animation["death"].speed = 1f; //all animations start at 0.
		animation.Play("death");

	}

So you can see that I stop the animation, and then play the next animation.

I have tried “animation.isPlaying” but it did no work, maybe It wasn’t implemented properly.

if(animation("death") has finsihed playing{
  then destroy the object
  
}

Thank you.

try typing this and you should get something ‘animationisplaying’ it is a if statement
good luck.
Survival of the fittest