die Animation is not playing

Animation for die is not playing just enemy is destroying y ? Given below script is attached to enemy when player shoots and health becomes 0 enemy should play die animation.but its not

function ApplyDemage(demage :int)
{
animation.CrossFade(“die”);
if(health==0)
{
animation.CrossFade(“die”);
Destroy(gameObject,2);
}
else
{
health -= demage;
}
}

Destroy function doesnt wait animation to end and destroys object immediately. You have to use coroutines.

i used this code .Its else condition is running…what to do now

if (animation[“die”].enabled == true)
{ Debug.Log(“die is playing.”);}
else{
Debug.Log(“not enabled”);
}