Space Shooter: If that impact but not explode or ship or asteroids.

Hello everyone! I am beginner in Unity and I am not a programmer, I do not know C #, as I discovered recently and loved it.
I have a problem, I am following the tutorial Space Shooter step. Upon reaching the video: “Counting Points - 14 - Space Shooter …” everything was fine, however, when shooting, the laser passes through the asteroids, and exploding sounds appear, but not the asteroid and the continuous laser is removed, and of course, it does not score.
Also, when the ship collides with an asteroid, explosion sound and if executed, but does not kill the ship.
I have reviewed over and over scripts, and are perfect, exactly as in the tutorial.
Something must be happening to me.
Please if you can help me I would appreciate it. The version is the latest, the 5.1.0f3

Here I leave the mistakes that gives me:

Can not find ‘Game Controllers’ script
UnityEngine.Debug: Log (Object)
DestroyByContact: Start () (at Assets / Scripts / DestroyByContact.cs: 20)

NullReferenceException: Object reference not set to an instance of an object
DestroyByContact.OnTriggerEnter (UnityEngine.Collider other) (at Assets / Scripts / DestroyByContact.cs: 33)

NullReferenceException: Object reference not set to an instance of an object
DestroyByContact.OnTriggerEnter (UnityEngine.Collider other) (at Assets / Scripts / DestroyByContact.cs: 35)

And the scripts just in case:

A) DestroyByContact.cs

using UnityEngine;
using System.Collections;

public class DestroyByContact : 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.tag == "Boundary")
	{
		return;
	}
	Instantiate(explosion, transform.position, transform.rotation);
	if (other.tag == "Player")
	{
		Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
		gameController.GameOver ();
	}
	gameController.AddScore (scoreValue);
	Destroy(other.gameObject);
	Destroy(gameObject);
}

}

B) GameController.cs

using UnityEngine;
using System.Collections;

public class GameController : MonoBehaviour
{
public GameObject hazard;
public Vector3 spawnValues;
public int hazardCount;
public float spawnWait;
public float startWait;
public float waveWait;

public GUIText scoreText;
public GUIText restartText;
public GUIText gameOverText;

private bool gameOver;
private bool restart;
private int score;

void Start ()
{
	gameOver = false;
	restart = false;
	restartText.text = "";
	gameOverText.text = "";
	score = 0;
	UpdateScore ();
	StartCoroutine (SpawnWaves ());
}

void Update ()
{
	if (restart)
	{
		if (Input.GetKeyDown (KeyCode.R))
		{
			Application.LoadLevel (Application.loadedLevel);
		}
	}
}

IEnumerator SpawnWaves ()
{
	yield return new WaitForSeconds (startWait);
	while (true)
	{
		for (int i = 0; i < hazardCount; i++)
		{
			Vector3 spawnPosition = new Vector3 (Random.Range (-spawnValues.x, spawnValues.x), spawnValues.y, spawnValues.z);
			Quaternion spawnRotation = Quaternion.identity;
			Instantiate (hazard, spawnPosition, spawnRotation);
			yield return new WaitForSeconds (spawnWait);
		}
		yield return new WaitForSeconds (waveWait);

		if (gameOver) 
		{
			restartText.text = "Press 'R' for Restart";
			restart = true;
			break;
		}
	}
}

public void AddScore (int newScoreValue)
{
	score += newScoreValue;
	UpdateScore ();
}

void UpdateScore ()
{
	scoreText.text = "Score: " + score;
}

public void GameOver ()
{
	gameOverText.text = "Game Over!";
	gameOver = true;
}

}

C) AND SCREEN

Hi Lorsan,

Welcome to the club! Hopefully you’ll get to grips in no time and be developing your dream games :slight_smile:

First thing I see is from the errors listed is that it cannot find a GameController. This is looking for a specific GameObject in your scene with a Tag of GameController.

If you are following the tutorials, I imagine you have an object called GameController in your hierarchy? If you select this, there is a Tag field at the very top of the inspector view. You may have to add a new tag to have it called GameController, and I believe this is covered within the tutorial?

Exactly, the error was that I had deleted the tag of Game Controllers and had not realized, and I was going crazy looking for the error in the scripts.
It is already solved and works perfectly.

Thank you very much for the answer and the speed. I’m going to keep having fun with Unity !!!
49358-tag-gamecontroller.png