Simple animation script not working (C#)

I have a script for when my player is hit by a bullet he plays a dying animation then the object is destroyed. But the script isn’t working i have added an animator to the player but still nothing happens. all that happens is the object getting destroyed and the animation not playing.


public GameObject player;	
public Animator animation;

        void Start () {
		animation = GetComponent<Animator> ();

	void OnTriggerEnter2D(Collider2D col)
		if(col.gameObject.tag == "Bullet")


So I take it that you want the animation to play THEN have your player destroyed. Just like it has been already said your immediately destroy your player after you start you animation. For all I know your animation could be playing but you destroy your player so fast you will never see it. Simply add a delay before you destroy your player or check to make sure your animation is done or in a certain state.