Vector3 screenPos = camera.WorldToScreenPoint(transform.position) ;'

이값을 쓰면 되지만 

 

안된다면

캔버스의 좌표가 0,0,0이 아니라서 일어나는 오류 인듯하다..

 

Vector3 screenPos = camera.WorldToScreenPoint(transform.position)  

 screenPos = 

new Vector3(screenPos.x -canvas.localPosition.x,   screenPos.y- canvas.localPosition.y, screenPos.zcanvas.localPosition.z);
   계산해준뒤 

 

 RectTransform rt = IsTaming.GetComponent<RectTransform>();
  rt.anchoredPosition =screenPos;

 

이렇게 넣어주니까 되었음...

 

 

 

 

 

+ Recent posts