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