在UIWidget 中添加以下函数。
获得的坐标系是以右上角为原点坐标,x轴向左,一轴向下。
public Vector2 GetTouchPoint()
{
Vector3 p0 = cachedTransform.worldToLocalMatrix.MultiplyPoint(UICamera.lastHit.point);
return new Vector2(p0.x+this.width/2,this.height/2 - p0.y );
}
在UIWidget 中添加以下函数。
获得的坐标系是以右上角为原点坐标,x轴向左,一轴向下。