Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

NullReferenceException: Object reference not set to an instance of an object?

I'm getting the error: "NullReferenceException: Object reference not set to an instance of an object" in the GameMaster script in Brackeys 2d platformer series, I've been trying to fix this for a day now and can't figure it out.

Here's the code:

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class GameMaster : MonoBehaviour {

  public static GameMaster GM;

  void Start() {

    if (GM == null) {

      GM = GameObject.FindWithTag("Player").GetComponent<GameMaster>();




  public Transform PlayerPrefab;

  public Transform SpawnPoint;

  public void RespawnPlayer () {

    Instantiate (PlayerPrefab, SpawnPoint.position, SpawnPoint.rotation);


  public static void KillPlayer(Player player) {

    Destroy (player.gameObject);




Sign In or Register to comment.