在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 );
}

相关文章:

  • 2021-11-07
  • 2021-11-07
  • 2021-11-07
  • 2021-11-07
  • 2021-11-07
  • 2021-11-07
  • 2022-01-12
猜你喜欢
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-07
相关资源
相似解决方案