[Canvas its RenderMode is set to ScreenSpaceOverlay]

transform.position = Input.mousePosition;


[Canvas its RenderMode is set to Other]

Vector2 pos;

RectTransformUtility.ScreenPointToLocalPointInRectangle(myCanvas.transform as RectTransform, Input.mousePosition, myCanvas.worldCamera, out pos);

transform.position = myCanvas.transform.TransformPoint(pos);

文章標籤
全站熱搜
創作者介紹
創作者 克羅 的頭像
克羅

克羅的UNITY教學 & 學習筆記

克羅 發表在 痞客邦 留言(2) 人氣(219)