IEnumerator DataUpdate() { while (true) { if (StateManager.state == StateManager.State.PRODUCTION) { yield return(new WaitForSeconds(6f)); date++; population.ChangePopulation(); factoryController.PayMaintenance(); DateTextUpdate(); } else { yield return(null); } } }