public IEnumerable <RaycastHit2D> CheckCollisionHit(LayerMask mask) { foreach (var hit in Up.GetHits(mask)) { yield return(hit); } foreach (var hit in Down.GetHits(mask)) { yield return(hit); } foreach (var hit in Left.GetHits(mask)) { yield return(hit); } foreach (var hit in Right.GetHits(mask)) { yield return(hit); } yield break; }