Programmer:)

[Unity] Access "Left", "Right", "Top" and "Bottom" of RectTransform via script 본문

DEV/Unity

[Unity] Access "Left", "Right", "Top" and "Bottom" of RectTransform via script

ryeggg 2022. 6. 3. 16:56
반응형

자꾸 헷갈려서 기록...

 

rectTransform.offsetMin = new Vector2(left,bottom);
rectTransform.offsetMax = new Vector2(right,top);

public Vector2 anchorMin = new Vector2(0, 0); // 부모의 왼쪽 하단을 기준
public Vector2 anchorMax = new Vector2(1, 1); // 부모의 오른쪽 상단을 기준
public Vector2 offsetMin = new Vector2(50, 50); // 왼쪽과 아래에서의 오프셋
public Vector2 offsetMax = new Vector2(-50, -50); // 오른쪽과 위에서의 오프셋

 

반응형
Comments