屏幕坐标转化为UI坐标
2018-03-04 本文已影响0人
CrixalisAs
private Vector3 GetPosition(Vector3 ScreeenPos, Canvas canvas)
{
Vector2 pos;
RectTransformUtility.ScreenPointToLocalPointInRectangle(canvas.transform as RectTransform,
ScreeenPos, canvas.worldCamera, out pos);
return new Vector3(pos.x, pos.y, 0);
}