This is the code in my GameController script:
public IEnumerator GameStart()
{
StartCoroutine(StageOneEnemyRoutine.StartAttack());
return null;
}
Here is the code in my StageOneEnemyRoutine script:
public static IEnumerator StartAttack()
{
float currentTime = Time.time;
while(Time.time <= currentTime + 120.0f)
{
if (portalCount < 2)
{
SpawnPortal();
return null;
}
if (GameController.GameIsOver())
break;
return null;
}
return null;
}
In the IDE there are no errors and everything compiles correctly. However, when I start the game and reach the point where the Coroutine is called I get the NullReferenceException error on the GameController script.
I have no idea why. Any help?