I have two scripts. The TileManager script is attached to the first sprite object Tile A (I've commented where the error occurs):
using UnityEngine;
using System.Collections;
using System.Text;
using System;
using UnityEngine.SceneManagement;
public class TileManager : MonoBehaviour
{
public ScoreAction addScore;
......
addScore.DummyMethod(); // Causes "NullReferenceException: Object reference not set to an instance of an object"
The ScoreAction script is attached to a TextMeshPro text object called Score:
using UnityEngine;
using System.Collections;
using System.Text;
public class ScoreAction : MonoBehaviour
{
[SerializeField] private GameObject Score;
......
public void DummyMethod ()
{
Debug.Log ("In ScoreAction");
}
I've tried different approaches to this, but just can't get around this obstacle.