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