IEnumerator CheckforEnemies() { Debug.Log("Check started!"); bool isEnemyInside; while (this) { isEnemyInside = false; if (CharacterController.instance != null) { colliders = Physics2D.OverlapCircleAll(CharacterController.instance.transform.position, distanceForEnemyFightMusic); foreach (Collider2D coll in colliders) { if (coll.GetComponent <EnemyController>() != null) { //Debug.Log($"collider name for game manager : {coll.name}"); soundTrackMan.Fight(); isEnemyInside = true; break; } } //Debug.Log($"Enemy inside: {isEnemyInside}"); if (!isEnemyInside) { //Debug.Log("No enemy found!"); soundTrackMan.OutOfFight(); } } yield return(waitMusic); } }