NullReferenceException on CoordinateLabeller script

Whenever the script runs such as when I switch back to the editor I get a NullReferenceException* error on all of the Tiles and the script sets itself to inactive. I copied the instructors script from the repo and the problem is unchanged. I’m not really sure what to do here and was hoping to get some guidance.

*The specific message:
NullReferenceException: Object reference not set to an instance of an object
CoordinateLabel.DisplayCoordinates () (at Assets/TowerDefense/Scripts/CoordinateLabel.cs:29)
CoordinateLabel.Awake () (at Assets/TowerDefense/Scripts/CoordinateLabel.cs:15)
UnityEditor.EditorApplication:Internal_CallGlobalEventHandler()

Hi James,

Welcome to our community! :slight_smile:

NullReferenceException means that a reference (“link”) to an instance is missing. Double click on the error message to see to which line in your code it is referring. If you exposed a field in the Inspector, make sure that it’s not empty.

Privacy & Terms