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