728x90
반응형
https://docs.unity3d.com/ScriptReference/RectTransform-anchoredPosition.html
Unity - Scripting API: RectTransform.anchoredPosition
The Anchored Position is the position of the pivot of the RectTransform taking into consideration the anchor reference point. The anchor reference point is the position of the anchors. If the anchors are not together, Unity estimates the four anchor positi
docs.unity3d.com
doc먼저 때린 뒤
첫 줄의 번역이 "앵커 참조점을 기준으로 한 이 RectTransform의 피벗 위치입니다." 요렇다.
요롷코롬 Anchor Presets을 통해 Anchor를 설정할 수 있고 설정한 Anchor에 따른 위 하얀 Image의 PosX, Y가 변하는 것을 확인할 수 있음
alt와 함께라면 이렇게도 할 수 있고.....
Anyway
요 위치를 get, set 하고 싶을 때가 종종 있는데 그때
RectTransform.anchoredPosition = new Vector2(value); 이렇게 set
RectTransform.anchoredPosition.x or RectTransform.anchoredPosition.y 요롷게 get
이런 식으로 하면 됨
이상하게 적어 둬야 할 것 같아 이상하게..
반응형
'Unity > Tips' 카테고리의 다른 글
Unity 꼭 있어야 할 component는 RequireComponent (0) | 2022.03.12 |
---|---|
Unity UI 사이즈 조절 [ RectTransform - sizeDelta] (0) | 2022.03.10 |
Unity transform.parent 보단 SetParent()를 사용하자 (0) | 2022.02.20 |
Unity Dotween Kill()이 안될 때 확인 (0) | 2022.02.14 |
Unity 애니메이션은 코드 없이 CrossFade (3) | 2022.02.13 |