Hello everyone,
Im having issues accessing a method in another script. I looked it up and found the same answer in many places, but I cant make it work. I keep getting error ˜Object reference is not an instance of an object˜
I`m doing it like this:
public class SpawnBg : MonoBehaviour {
GameManager gm;
void Awake () {
gm.GetComponent ();
}
public void OnTriggerEnter2D (Collider2Dcol) {
if (col.CompareTag(“Player”)){
gm.BackgroundSpawn();
}
}
}
GameManager is my other class that I need to access. Help plz!
Thank you!