Here’s my problem that i’ve been trying to solve for the past couple of days:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Coin : MonoBehaviour {
private void OnTriggerEnter(Collider other)
{
if (other.tag == "Player")
{
Debug.Log("hello");
//ScoreManager.Instance.GetCoin();
Destroy(this.gameObject,1f);
}
}
}
Now, when the Player collides with the coin, it outputs hello. But, when i uncomment the commented line, it throws a NullReferenceException. Now, i do have a script that’s named ScoreManager. I don’t understand why this happens.