Play Animation after Collision

I’m pretty new to scripting in Unity, I’ve looked around on Google for an answer but cant seem to find anything. I have an Asteroid, Spaceship, and an Explosion animation. When the Ship hits the Asteroid I want it to play the Explosion animation. Alright Here’s what I got:

public class Animation : MonoBehaviour {

void OnTriggerEnter2D(Collider2D other)


if (other.tag == “Player”)





This is the script that is attached to the Asteroid, both objects do have colliders on them, I’ve made sure they work by using the Debug.Log. Right now the asteroid just disappears when the ship hits it, no animation is played. Any help would be appreciated!

Its not animating because your object was destroied.

You need to put your animation in another GameObject or you need to wait for certain time (seconds) before to destroy your object. Then it will animate until destroy it.