IEnumerator CheckResources() { yield return(new WaitForSeconds(2)); while (true) { if (!gettingResource2 && myData.NeedResource2()) { StartRetrieval(); } yield return(new WaitForSeconds(1)); } }