IEnumerator HouseUpdate() { yield return(new WaitForSeconds(1)); while (true) { if (myData != null) { myData.ProcessTimeTick(); int theLevel = myData.GetLevel(); if (theLevel != curLevel) { curLevel = theLevel; //fix the level GetComponent <Renderer> ().material = levelMats [curLevel]; } } yield return(new WaitForSeconds(1)); } }