Hi
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.
CODE
public GameObject player;
public Animator animation;
void Start () {
animation = GetComponent<Animator> ();
}
void OnTriggerEnter2D(Collider2D col)
{
if(col.gameObject.tag == "Bullet")
{
animation.Play("Dying");
Destroy(player);
}
}