so... I am trying to make an animation appear when you beat the level. this will be accomplished by activating the object when the level ends, however I got an error when the level ended.
this is the error
Object reference not set to an instance of an object
so I start it out like this
void Awake()
{
GameObject endan = GameObject.Find("Levelthing");
endan.SetActive(false);
}
I removed unimportant code in the awake function, this code works.
the level ends after a certain amount of time has passed
IEnumerator Counts()
{
Debug.Log("Counting");
yield return new WaitForSeconds(264);
Debug.Log("Level Complete");
GameObject eendan = GameObject.Find("Levelthing");
eendan.SetActive(true);
}
after researching the error I found that it meant that it meant the reference was not found. to "eendan" (my variables have weird names) even though I had referenced it the line above.