I am using inheritance (C#) with a base class that has
public GameSystem temp = (GameSystem)GameObject.Find("Manager").GetComponent("GameSystem");
and I want my subclasses to be able to use temp, but whenever i try to use temp i get this error
NullReferenceException: Object reference not set to an instance of an object TargetControl.OnMouseDown () (at Assets/Scripts/TargetControl.cs:37) UnityEngine.SendMouseEvents:DoSendMouseEvents()ne.SendMouseEvents:DoSendMouseEvents()
But this works. But if I replace Debug.log with the base class object it errors.
GameSystem temp = (GameSystem)GameObject.Find("Manager").GetComponent("GameSystem");
Debug.Log(temp.gameTimer);