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