Vector2 pos;
Canvas canvas = GameObject.Find("Canvas").GetComponent<Canvas>();
RectTransformUtility.ScreenPointToLocalPointInRectangle(canvas.transform as RectTransform,
Camera.main.WorldToScreenPoint(transform.position), canvas.worldCamera, out pos);
Debug.Log(pos);
网友评论