public RectTransform LeftTouchArea;
public RectTransform RightTouchArea;
private void Update()
{
if (Input.GetMouseButtonDown(0))
{
//获取鼠标的位置
Vector2 mousePos = Input.mousePosition;
//判断Image的坐标是否包含点击的坐标
if (RectTransformUtility.RectangleContainsScreenPoint(LeftTouchArea, mousePos))
{
}
else if (RectTransformUtility.RectangleContainsScreenPoint(RightTouchArea, mousePos))
{
}
}
}