Im having an error during runtime with my image and text. I have both objects created in my hierarchy named correctly but apparently my script cant find them. Why isn't what i have written not sufficient? All i get in the error is Object reference not set to an instance of an object, but i don't understand why i need to create an instance of this object when i have one in my hierarchy.
I'm still relatively new to both unity and c# and couldn't find any real explanatory answer by searching and the unity tutorials weren't very helpful since I'm sure its just a basic question about c#
private Text serverInfoText;
private GameObject serverInfoImage;
void Awake()
{
serverInfoImage = GameObject.Find ("ServerInfoImage");
serverInfoImage.SetActive (false);
serverInfoText = GameObject.Find("ServerInfoText").GetComponent<Text>();
}