Everything works perfectly in the Unity Editor, but when I push to a build version, everything that involves calling methods in other scripts breaks.
I’ve been using the method of:
public GameObject goalTrackingEmpty;
goalTrackingEmpty.GetComponent<GoalTracking>().orangeScores();
where goalTrackingEmpty is an empty GameObject with GoalTracking.cs attached to it. I did it this way because I didn’t want to make everything static, but for some reason it’s just refusing to work in the build version of the game. I checked the error logs and I see this:
NullReferenceException: Object reference not set to an instance of an object
at GoalTracking.orangeScores () [0x00000] in <filename unknown>:0
at BlueGoalDetection.OnCollisionEnter2D (UnityEngine.Collision2D collision) [0x00000] in <filename unknown>:0
(Filename: Line: -1)
which doesn’t really tell me much.