//flyer timer IEnumerator SpawnFlyer() { //random float float res = Random.Range(0f, 1f); flyer_wait = true; //if the random is less than the flyer probability, spawn a flyer if (res < probability && spawing_flyers) { GameObject flyer = Instantiate(Flyer, this.transform.position, Quaternion.identity); spawner.AddFlyer(flyer); } //wait the 'ad_rate' number of seconds before attempting to drop another flyer yield return(new WaitForSecondsRealtime(ad_rate)); flyer_wait = false; spawing_flyers = true; }