IEnumerator GameTimerFunction() { startTime = Time.fixedTime; yield return(new WaitForSeconds(initialGameTime)); Debug.Log("Time is up"); VictoryCondition vc = va.gameObject.GetComponentInChildren(typeof(VictoryCondition)) as VictoryCondition; vc.loseByTimeUp(); }