How to implement animation on trigger/without?


Iam pretty new to making games and such and I ran into o’ so many problems, this is one of them and the tutorial script would not work, its a phsyics “mover” game and when the player runs to a laser, he is destroyed. from now on I would like to make a death animation, an explosion of some sort and I do not know how to implement the animation in place of the destroyed player.

I can guess the animation comes befor the player is destroyed since it would have to be linked to the player and that would not do if he is destroyed, or would it?

I have searched for days but while its a very common question (from what I can tell) nothing has been helpful one bit

Any help would be really apriciated! :smiley:
Thank you

If you want to use a particle system to simulate the explosion then:

  1. Make a prefab of a GameObject with a particle system attached.
  2. Edit your particle system to make it looks like an explosion.
  3. Reference your prefab to your script through the editor.
  4. Call: Instantiate (explosion_prefab); when you need it.
  5. Set the position of the gameObject to be the same of your player.
  6. You can destroy your player object.