IEnumerator SpawnFireBall() { if (ball != null) { while (true) { yield return(new WaitForSeconds(Level.GetFireBallSpawnSeconds())); if (ball != null) { Vector2 FireBallPos = new Vector2(ball.transform.position.x, 6.0f); FindObjectOfType <AudioManager>().Play("FireballSFX"); fireBall = Instantiate(fireball, FireBallPos, Quaternion.identity); } } } else { yield return(null); } }