Space Shooter Player Will Not Instantiate an Explosion After Getting Killed

I am a beginner to Unity and I am currently going through the Unity tutorial “Space Shooter” and am currently going through the adding hazards, enemies, etc portion. I found that through this process that it stopped Instantiating the explosion for the player and won’t play the sound either. Hopefully I can get some help to fix this.

There are too many ways that could make your game not working… you should be more specific in you questions in the future.
i’ll write down some potential problems I can think of…

  1. haven’t you accidentaly removed the tag “player” from your player?
  2. is your DestroyByContact script in the right place?
  3. is you destroyByContact script the same as it should be? as here at the bottom of the page: (scripting context)
  4. does your player have the right collider set? isn’t the collider disabled in the Inspector by accident on your player prefab?
  5. is your player destroyed, but the explosion doesn’t play? is the explosion still in the project? haven’t you erased it by accident?

Could you post your code on here ( click the little button that says 101010 next to the paper clip) so that we can better see what your problem could be?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DestoryByContact : MonoBehaviour
    public GameObject explosion;
    public GameObject playerExplosion;
    public int scoreValue;
    private GameController gameController;

    void Start()
        GameObject gameControllerObject = GameObject.FindWithTag("GameController");
        if (gameControllerObject != null)
            gameController = gameControllerObject.GetComponent <GameController>();
        if(gameController == null)
             Debug.Log("Cannot find 'GameController' script.");

    void OnTriggerEnter(Collider other)
        if (other.CompareTag ("Boundary") || other.CompareTag ("Enemy"))

        if (explosion != null)
            Instantiate(explosion, transform.position, transform.rotation);

        if (other.CompareTag ("Player"))
            Instantiate(playerExplosion, other.transform.position, other.transform.rotation);

        gameController.AddScore (scoreValue);

I don’t know if the mispelling of the class (DestoryByContact instead of DestroyByContact) (tory instead of troy) would cause a problem.

Are you getting any build/compile errors in the console.log?

Are you sure you haven’t accidentally used/modified the code in the _Complete_Game directory?

And, as MochiTo says, confirm your tags ( GameController, Player, Enemy, Boundary. Existence, spelling AND punctuation)