raycast2d hit unity code example Example: raycasthit2d unity RaycastHit2D hit = Physics2D.Raycast(transform.position, -Vector2.up);