Animation.CrossFade waiting for transition to finish

I am calling Animation.CrossFade inside OnMouseDown even to make a transition of animation state within 3 seconds interval. I want to destroy the game object right after the transition finished but not before that. Below is the code:

void OnMouseDown()
{
    GetComponent<Animator>().CrossFade("statename", 3f);
    Destroy(gameObject);
}

But it is being destroyed before the transition is done. How can I make it wait for the transition to finish, then destroy it?

<< Destroy(gameObject,3); >> destroy your object after 3 second .

but maybe you need wait until this line complete :

GetComponent<Animator>().CrossFade("statename", 3f);

SO you need yeild

im not sure and i don’t use yeild before !