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;
이렇게 넣어주니까 되었음...
'유니티unity' 카테고리의 다른 글
Unity Random VS System Random (0) | 2020.07.09 |
---|---|
전장의 안개 공부한 영상공유 (0) | 2020.06.30 |
공유)딕셔너리 인스펙터창 등록 (0) | 2020.05.14 |
c#리스트 sort 사용하기위한 함수 (0) | 2020.05.07 |
Coroutine의 yield 함수 종류들 (0) | 2020.02.13 |