Here's my problem that i've been trying to solve for the past couple of days: Code (CSharp): 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.
Show ScoreManager script. Are you setting the Instance variable = to "this" in Awake or Start in ScoreManager? NullReferenceExceptions are pretty easy to solve. It means something doesn't have a value, thus it is null, but you are trying to access it. So Instance is null.