---
title: "앵커는 화면이 늘어날 때 어디에 붙어 있을지 정한다"
description: "같은 Pos X 60 이 앵커에 따라 왼쪽에서 60 이 되기도, 가운데에서 60 이 되기도 합니다. RectTransform 의 앵커와 피벗을 Figma 컨스트레인트와 나란히 놓고 봅니다."
author: "유니얼"
pubDate: 2026-09-10
category: "game-dev/unity/ui"
tags: ["Unity", "UI", "uGUI"]
canonical: https://blog.unialgames.com/posts/unity-ui-rect-transform-anchor/
---
시안대로 만든 화면을 가로가 긴 폰에서 켜 봅니다.
오른쪽 위에 있어야 할 설정 버튼이 화면 가운데쯤에 떠 있습니다.
배경은 양옆이 비어 있고, 상단 바는 화면 끝까지 닿지 않습니다.

**대부분 앵커 때문입니다.** 위치를 숫자로 맞춰도,
그 숫자를 **어디서부터 쟀는지** 가 틀리면 화면 크기가 바뀌는 순간 어긋납니다.

## RectTransform 은 사각형이다

Unity 에서 일반 오브젝트는 **Transform** 으로 위치, 회전, 크기(Scale)를 가집니다.
UI 요소는 그 대신 **RectTransform** 을 씁니다. Transform 이 가진 것에 **너비와 높이** 가 더 붙어 있습니다.

그래서 UI 는 크기를 두 가지로 바꿀 수 있습니다.

| | Width, Height | Scale |
| --- | --- | --- |
| 바뀌는 것 | 사각형 자체의 크기 | 그려진 결과를 확대, 축소 |
| 9-slice 테두리 두께 | 그대로 | 같이 두꺼워짐 |
| 안에 든 글자 크기 | 그대로 | 같이 커짐 |
| 쓰는 곳 | **레이아웃** | 누를 때 살짝 작아지는 연출, 등장 애니메이션 |

씬 뷰에서 사각형 모서리를 끌면 Unity 는 Scale 이 아니라 Width 와 Height 를 바꿉니다.
**화면에 맞춰 크기를 정하는 일은 Width 와 Height 로 합니다.**
Scale 로 맞춰 두면 테두리와 글자까지 같이 늘어나서 시안과 달라집니다.

## Pos X 60 은 어디서부터 60 인가

Figma 에서 X 60 은 부모 프레임의 **왼쪽 위 모서리** 에서 60 입니다. 기준이 늘 같습니다.

Unity 의 Pos X 는 기준이 요소마다 다릅니다. 두 개의 점이 정합니다.

- **앵커(Anchor):** 부모 사각형 위의 기준점. 부모 너비의 0 에서 1 사이 비율로 적습니다. 0 이 왼쪽, 0.5 가 가운데, 1 이 오른쪽입니다
- **피벗(Pivot):** 내 사각형 위의 기준점. 역시 내 크기의 0 에서 1 사이 비율입니다

**Pos 는 앵커에서 피벗까지의 거리** 입니다.

<figure class="diagram">
<svg viewBox="0 0 680 230" role="img" aria-label="같은 Pos X 60 이 앵커가 왼쪽이면 부모 왼쪽에서 60, 앵커가 가운데면 부모 가운데에서 60 떨어진 자리가 된다는 그림">
<text x="30" y="28" font-size="13" fill="var(--text)">앵커 (0, 0.5): 왼쪽 가운데</text>
<text x="370" y="28" font-size="13" fill="var(--text)">앵커 (0.5, 0.5): 정가운데</text>
<g stroke="var(--border)" fill="var(--bg)">
<rect x="30" y="40" width="280" height="130" rx="3"></rect>
<rect x="370" y="40" width="280" height="130" rx="3"></rect>
</g>
<g stroke="var(--text-muted)" fill="var(--bg)">
<rect x="50" y="88" width="80" height="34" rx="3"></rect>
<rect x="530" y="88" width="80" height="34" rx="3"></rect>
</g>
<g fill="var(--accent)">
<polygon points="30,97 38,105 30,113 22,105"></polygon>
<polygon points="510,97 518,105 510,113 502,105"></polygon>
</g>
<g stroke="var(--warn)" stroke-width="2" fill="var(--bg)">
<circle cx="90" cy="105" r="4"></circle>
<circle cx="570" cy="105" r="4"></circle>
</g>
<g stroke="var(--text-muted)">
<line x1="30" y1="140" x2="30" y2="156"></line>
<line x1="90" y1="140" x2="90" y2="156"></line>
<line x1="30" y1="148" x2="90" y2="148"></line>
<line x1="510" y1="140" x2="510" y2="156"></line>
<line x1="570" y1="140" x2="570" y2="156"></line>
<line x1="510" y1="148" x2="570" y2="148"></line>
</g>
<text x="60" y="190" font-size="12" text-anchor="middle" font-family="var(--font-mono)" fill="var(--text)">Pos X 60</text>
<text x="540" y="190" font-size="12" text-anchor="middle" font-family="var(--font-mono)" fill="var(--text)">Pos X 60</text>
<polygon points="30,207 36,213 30,219 24,213" fill="var(--accent)"></polygon>
<text x="44" y="217" font-size="12" fill="var(--text-muted)">앵커: 부모 위의 기준점</text>
<circle cx="220" cy="213" r="4" stroke="var(--warn)" stroke-width="2" fill="var(--bg)"></circle>
<text x="232" y="217" font-size="12" fill="var(--text-muted)">피벗: 내 사각형 위의 기준점 (여기서는 가운데)</text>
</svg>
<figcaption>숫자는 같고 기준이 다릅니다. 인스펙터의 Pos X 만 보고는 버튼이 어디 있는지 알 수 없습니다.</figcaption>
</figure>

하나 더 다른 것이 있습니다. **Y 방향이 반대입니다.**
Figma 는 아래로 갈수록 Y 가 커지고, Unity 는 **위로 갈수록 커집니다.** 앵커도 0 이 아래, 1 이 위입니다.
시안에서 "위에서 40" 인 요소를 위쪽 앵커에 붙이고 피벗도 위에 두면, Unity 에서는 Pos Y 가 -40 이 됩니다.

## 앵커는 부모가 커질 때 붙잡는 자리다

앵커가 기준점이라는 것만으로는 왜 중요한지 잘 안 보입니다.
**부모 크기가 바뀔 때** 차이가 드러납니다.

상단 바에 버튼 셋이 있습니다. 뒤로 가기는 왼쪽 위, 제목은 가운데 위, 설정은 오른쪽 위에 앵커를 두었습니다.
화면이 가로로 길어지면 이렇게 됩니다.

<figure class="diagram">
<svg viewBox="0 0 680 240" role="img" aria-label="왼쪽 위 앵커 버튼은 왼쪽에, 가운데 위 앵커 제목은 가운데에, 오른쪽 위 앵커 설정 버튼은 오른쪽 끝에 붙은 채 화면만 넓어지는 그림">
<text x="40" y="30" font-size="12" fill="var(--text-muted)">기준 화면</text>
<text x="40" y="140" font-size="12" fill="var(--text-muted)">가로가 더 긴 화면</text>
<g stroke="var(--border)" fill="var(--bg)">
<rect x="40" y="40" width="360" height="70" rx="3"></rect>
<rect x="40" y="150" width="600" height="70" rx="3"></rect>
</g>
<g stroke="var(--text-muted)" fill="var(--bg)">
<rect x="56" y="57" width="70" height="30" rx="3"></rect>
<rect x="185" y="57" width="70" height="30" rx="3"></rect>
<rect x="314" y="57" width="70" height="30" rx="3"></rect>
<rect x="56" y="167" width="70" height="30" rx="3"></rect>
<rect x="305" y="167" width="70" height="30" rx="3"></rect>
<rect x="554" y="167" width="70" height="30" rx="3"></rect>
</g>
<g font-size="12" text-anchor="middle" fill="var(--text)">
<text x="91" y="77">뒤로</text>
<text x="220" y="77">제목</text>
<text x="349" y="77">설정</text>
<text x="91" y="187">뒤로</text>
<text x="340" y="187">제목</text>
<text x="589" y="187">설정</text>
</g>
<g fill="var(--accent)">
<polygon points="40,33 47,40 40,47 33,40"></polygon>
<polygon points="220,33 227,40 220,47 213,40"></polygon>
<polygon points="400,33 407,40 400,47 393,40"></polygon>
<polygon points="40,143 47,150 40,157 33,150"></polygon>
<polygon points="340,143 347,150 340,157 333,150"></polygon>
<polygon points="640,143 647,150 640,157 633,150"></polygon>
</g>
<text x="430" y="70" font-size="12" fill="var(--text-muted)">앵커(마름모)가 부모 모서리와</text>
<text x="430" y="88" font-size="12" fill="var(--text-muted)">가운데를 따라 움직이고</text>
<text x="430" y="106" font-size="12" fill="var(--text-muted)">버튼은 앵커와의 거리를 지킵니다</text>
</svg>
<figcaption>세 버튼 모두 Pos 숫자는 그대로입니다. 앵커가 따라간 만큼 버튼이 따라갑니다.</figcaption>
</figure>

설정 버튼을 **왼쪽 위 앵커** 에 두고 Pos X 만 크게 줘서 오른쪽에 붙여 두었다면,
기준 화면에서는 똑같이 보이지만 긴 화면에서는 가운데쯤에 남습니다.
처음에 본 증상이 이것입니다. **기준 화면에서는 틀린 앵커가 드러나지 않습니다.**

## 앵커를 벌리면 크기가 따라 늘어난다

앵커는 사실 점 하나가 아니라 **두 개** 입니다. 왼쪽 아래를 붙잡는 Min, 오른쪽 위를 붙잡는 Max 입니다.
지금까지는 둘을 한 자리에 겹쳐 두었습니다. **둘을 벌리면** 요소가 두 앵커 사이에 걸쳐 늘어납니다.

가로로 벌리면 인스펙터 칸이 바뀝니다.
Pos X 와 Width 가 사라지고 **Left 와 Right** 가 나옵니다. 세로로 벌리면 Pos Y 와 Height 대신 **Top 과 Bottom** 이 나옵니다.
네 칸 모두 **앵커에서 안쪽으로 들어온 거리** 입니다. 크기가 아니라 여백을 적는 셈입니다.

<figure class="diagram">
<svg viewBox="0 0 680 230" role="img" aria-label="앵커를 부모 왼쪽 위와 오른쪽 위로 벌린 상단 바가 화면이 넓어져도 좌우 여백 16 을 지키며 늘어나는 그림">
<g stroke="var(--border)" fill="var(--bg)">
<rect x="40" y="30" width="360" height="80" rx="3"></rect>
<rect x="40" y="140" width="600" height="80" rx="3"></rect>
</g>
<g stroke="var(--accent)" fill="var(--accent-soft)">
<rect x="56" y="44" width="328" height="30" rx="3"></rect>
<rect x="56" y="154" width="568" height="30" rx="3"></rect>
</g>
<text x="220" y="64" font-size="12" text-anchor="middle" fill="var(--accent)">상단 바</text>
<text x="340" y="174" font-size="12" text-anchor="middle" fill="var(--accent)">상단 바</text>
<g fill="var(--accent)">
<polygon points="40,23 47,30 40,37 33,30"></polygon>
<polygon points="400,23 407,30 400,37 393,30"></polygon>
<polygon points="40,133 47,140 40,147 33,140"></polygon>
<polygon points="640,133 647,140 640,147 633,140"></polygon>
</g>
<g stroke="var(--text-muted)">
<line x1="40" y1="92" x2="56" y2="92"></line>
<line x1="384" y1="92" x2="400" y2="92"></line>
<line x1="40" y1="202" x2="56" y2="202"></line>
<line x1="624" y1="202" x2="640" y2="202"></line>
</g>
<g font-size="11" font-family="var(--font-mono)" fill="var(--text-muted)">
<text x="62" y="96">Left 16</text>
<text x="378" y="96" text-anchor="end">Right 16</text>
<text x="62" y="206">Left 16</text>
<text x="618" y="206" text-anchor="end">Right 16</text>
</g>
</svg>
<figcaption>앵커 둘이 부모 양끝에 붙어 있으니 바는 여백 16 을 지키며 늘어납니다.</figcaption>
</figure>

벌린 앵커는 이런 곳에 씁니다.

- **화면 끝까지 닿아야 하는 것:** 상단 바, 하단 탭, 풀스크린 딤, 배경
- **비율로 차지해야 하는 것:** 앵커를 0.1 과 0.9 에 두고 Left, Right 를 0 으로 두면 부모 너비의 80퍼센트를 늘 차지합니다

부모를 가득 채우는 요소는 앵커를 (0, 0) 과 (1, 1) 로 벌리고 네 칸을 전부 0 으로 둡니다.
배경과 딤은 대부분 이 설정입니다.

## Figma 컨스트레인트와 나란히 놓기

Figma 의 **Constraints** 가 정확히 같은 일을 합니다. 프레임 크기가 바뀔 때 요소가 무엇을 붙잡을지 정합니다.
그래서 일대일로 옮겨집니다.

| Figma 가로 컨스트레인트 | Unity 앵커 Min X / Max X | 인스펙터 칸 |
| --- | --- | --- |
| Left | 0 / 0 | Pos X, Width |
| Right | 1 / 1 | Pos X, Width |
| Center | 0.5 / 0.5 | Pos X, Width |
| Left and right | 0 / 1 | Left, Right |
| Scale | 요소 양끝의 비율 (예: 0.2 / 0.6) | Left, Right 를 0 |

세로도 같습니다. Top 은 1 / 1, Bottom 은 0 / 0, Top and bottom 은 0 / 1 입니다. (Unity 는 아래가 0 입니다.)

**시안에 컨스트레인트를 제대로 걸어 두면 그 자체가 앵커 명세** 가 됩니다.
Figma 에서 프레임 크기를 늘려 보고 요소가 원하는 대로 따라오는지 확인하는 것만으로,
Unity 에서 어긋날 자리를 미리 찾을 수 있습니다.

## 피벗은 무엇을 중심으로 돌고 자라는가

Unity 문서는 피벗을 이렇게 설명합니다. **회전, 크기 변경, Scale 이 모두 피벗을 중심으로 일어납니다.**

크기가 바뀔 때를 보면 차이가 분명합니다. 같은 박스의 너비를 늘려 보면 피벗에 따라 자라는 방향이 다릅니다.

<figure class="diagram">
<svg viewBox="0 0 680 200" role="img" aria-label="피벗 X 가 0 이면 오른쪽으로, 0.5 면 양쪽으로, 1 이면 왼쪽으로 박스가 자라는 그림">
<g font-size="12" font-family="var(--font-mono)" fill="var(--text)">
<text x="30" y="55">Pivot X 0</text>
<text x="30" y="115">Pivot X 0.5</text>
<text x="30" y="175">Pivot X 1</text>
</g>
<g stroke="var(--accent)" fill="var(--accent-soft)">
<rect x="200" y="35" width="200" height="30" rx="3"></rect>
<rect x="200" y="95" width="200" height="30" rx="3"></rect>
<rect x="200" y="155" width="200" height="30" rx="3"></rect>
</g>
<g stroke="var(--text-muted)" fill="none" stroke-dasharray="4 3">
<rect x="200" y="35" width="120" height="30" rx="3"></rect>
<rect x="240" y="95" width="120" height="30" rx="3"></rect>
<rect x="280" y="155" width="120" height="30" rx="3"></rect>
</g>
<g stroke="var(--warn)" stroke-width="2" fill="var(--bg)">
<circle cx="200" cy="50" r="4"></circle>
<circle cx="300" cy="110" r="4"></circle>
<circle cx="400" cy="170" r="4"></circle>
</g>
<g font-size="12" fill="var(--text-muted)">
<text x="430" y="55">오른쪽으로 자란다</text>
<text x="430" y="115">양쪽으로 자란다</text>
<text x="430" y="175">왼쪽으로 자란다</text>
</g>
<text x="200" y="20" font-size="12" fill="var(--text-muted)">점선이 원래 크기, 원이 피벗</text>
</svg>
<figcaption>피벗은 크기가 바뀌어도 제자리에 있습니다. 나머지가 피벗에서 멀어지는 쪽으로 자랍니다.</figcaption>
</figure>

그래서 피벗은 **내용이 늘어나는 방향** 을 보고 정합니다.

| 요소 | 피벗 | 이유 |
| --- | --- | --- |
| 캐릭터 머리 위 말풍선 | 아래 가운데 (0.5, 0) | 글이 길어지면 위로 자라야 머리를 안 가립니다 |
| 왼쪽에서 차오르는 게이지 | 왼쪽 (0, 0.5) | 오른쪽으로만 늘어납니다 |
| 오른쪽 위 알림 목록 | 오른쪽 위 (1, 1) | 항목이 늘면 아래와 왼쪽으로 펼쳐집니다 |
| 가운데서 커지며 뜨는 팝업 | 가운데 (0.5, 0.5) | Scale 연출의 중심이 가운데여야 합니다 |

인스펙터에서 피벗을 바꾸면 Pos 숫자가 같이 바뀝니다.
**Unity 가 화면상의 위치를 지키려고 Pos 를 맞춰 준 것** 이니 놀라지 않아도 됩니다.
RectTransform 오른쪽 위의 **R (Raw edit mode)** 버튼을 켜면 이 보정을 하지 않습니다.
그때는 Pos 숫자가 그대로인 대신 요소가 화면에서 움직입니다.

## 앵커 프리셋

앵커 숫자를 직접 치는 일은 드뭅니다. **앵커 프리셋** 에서 고릅니다.

RectTransform 왼쪽 위의 네모 아이콘이 프리셋 버튼입니다.
아이콘 **위에 가로 설정, 왼쪽에 세로 설정** 이 글자로 적혀 있어서 지금 상태를 바로 읽을 수 있습니다.
위에 center, 왼쪽에 stretch 라고 적혀 있으면 가로는 가운데에 붙어 있고 세로는 벌어져 있다는 뜻입니다.
그래서 옆 칸도 가로는 **Pos X, Width**, 세로는 **Top, Bottom** 으로 섞여 나옵니다.

아이콘을 누르면 이런 표가 열립니다.

<figure class="diagram">
<svg viewBox="0 0 680 420" role="img" aria-label="앵커 프리셋 창을 옮겨 그린 표. 가로 left center right stretch 네 칸과 세로 top middle bottom stretch 네 줄의 조합이고, 맨 위 줄은 가로만, 맨 왼쪽 칸은 세로만 바꾸며, 오른쪽 아래 stretch 칸은 부모를 꽉 채운다">
<text x="20" y="26" font-size="13" font-family="var(--font-mono)" fill="var(--text)">Anchor Presets</text>
<text x="20" y="46" font-size="12" font-family="var(--font-mono)" fill="var(--text-muted)">Shift: Also set pivot</text>
<text x="220" y="46" font-size="12" font-family="var(--font-mono)" fill="var(--text-muted)">Alt: Also set position</text>
<text x="222" y="70" font-size="11" text-anchor="middle" font-family="var(--font-mono)" fill="var(--text-muted)">left</text>
<text x="286" y="70" font-size="11" text-anchor="middle" font-family="var(--font-mono)" fill="var(--text-muted)">center</text>
<text x="350" y="70" font-size="11" text-anchor="middle" font-family="var(--font-mono)" fill="var(--text-muted)">right</text>
<text x="414" y="70" font-size="11" text-anchor="middle" font-family="var(--font-mono)" fill="var(--text-muted)">stretch</text>
<text x="120" y="174" font-size="11" text-anchor="end" font-family="var(--font-mono)" fill="var(--text-muted)">top</text>
<text x="120" y="238" font-size="11" text-anchor="end" font-family="var(--font-mono)" fill="var(--text-muted)">middle</text>
<text x="120" y="302" font-size="11" text-anchor="end" font-family="var(--font-mono)" fill="var(--text-muted)">bottom</text>
<text x="120" y="366" font-size="11" text-anchor="end" font-family="var(--font-mono)" fill="var(--text-muted)">stretch</text>
<g stroke="var(--border)" fill="var(--bg)">
<rect x="130" y="78" width="56" height="56" rx="4"></rect>
<rect x="194" y="78" width="56" height="56" rx="4"></rect>
<rect x="258" y="78" width="56" height="56" rx="4"></rect>
<rect x="322" y="78" width="56" height="56" rx="4"></rect>
<rect x="386" y="78" width="56" height="56" rx="4"></rect>
<rect x="130" y="142" width="56" height="56" rx="4"></rect>
<rect x="194" y="142" width="56" height="56" rx="4"></rect>
<rect x="258" y="142" width="56" height="56" rx="4"></rect>
<rect x="322" y="142" width="56" height="56" rx="4"></rect>
<rect x="386" y="142" width="56" height="56" rx="4"></rect>
<rect x="130" y="206" width="56" height="56" rx="4"></rect>
<rect x="194" y="206" width="56" height="56" rx="4"></rect>
<rect x="258" y="206" width="56" height="56" rx="4"></rect>
<rect x="322" y="206" width="56" height="56" rx="4"></rect>
<rect x="386" y="206" width="56" height="56" rx="4"></rect>
<rect x="130" y="270" width="56" height="56" rx="4"></rect>
<rect x="194" y="270" width="56" height="56" rx="4"></rect>
<rect x="258" y="270" width="56" height="56" rx="4"></rect>
<rect x="322" y="270" width="56" height="56" rx="4"></rect>
<rect x="386" y="270" width="56" height="56" rx="4"></rect>
<rect x="130" y="334" width="56" height="56" rx="4"></rect>
<rect x="194" y="334" width="56" height="56" rx="4"></rect>
<rect x="258" y="334" width="56" height="56" rx="4"></rect>
<rect x="322" y="334" width="56" height="56" rx="4"></rect>
</g>
<g stroke="var(--accent)" stroke-width="2" fill="var(--bg)">
<rect x="386" y="334" width="56" height="56" rx="4"></rect>
</g>
<g stroke="var(--text-muted)" fill="none">
<rect x="140" y="88" width="36" height="36"></rect>
<rect x="204" y="88" width="36" height="36"></rect>
<rect x="268" y="88" width="36" height="36"></rect>
<rect x="332" y="88" width="36" height="36"></rect>
<rect x="396" y="88" width="36" height="36"></rect>
<rect x="140" y="152" width="36" height="36"></rect>
<rect x="204" y="152" width="36" height="36"></rect>
<rect x="268" y="152" width="36" height="36"></rect>
<rect x="332" y="152" width="36" height="36"></rect>
<rect x="396" y="152" width="36" height="36"></rect>
<rect x="140" y="216" width="36" height="36"></rect>
<rect x="204" y="216" width="36" height="36"></rect>
<rect x="268" y="216" width="36" height="36"></rect>
<rect x="332" y="216" width="36" height="36"></rect>
<rect x="396" y="216" width="36" height="36"></rect>
<rect x="140" y="280" width="36" height="36"></rect>
<rect x="204" y="280" width="36" height="36"></rect>
<rect x="268" y="280" width="36" height="36"></rect>
<rect x="332" y="280" width="36" height="36"></rect>
<rect x="396" y="280" width="36" height="36"></rect>
<rect x="140" y="344" width="36" height="36"></rect>
<rect x="204" y="344" width="36" height="36"></rect>
<rect x="268" y="344" width="36" height="36"></rect>
<rect x="332" y="344" width="36" height="36"></rect>
<rect x="396" y="344" width="36" height="36"></rect>
</g>
<g stroke="var(--text-muted)" fill="var(--accent-soft)">
<rect x="208" y="101" width="12" height="10"></rect>
<rect x="280" y="101" width="12" height="10"></rect>
<rect x="352" y="101" width="12" height="10"></rect>
<rect x="400" y="101" width="28" height="10"></rect>
<rect x="152" y="156" width="12" height="10"></rect>
<rect x="208" y="156" width="12" height="10"></rect>
<rect x="280" y="156" width="12" height="10"></rect>
<rect x="352" y="156" width="12" height="10"></rect>
<rect x="400" y="156" width="28" height="10"></rect>
<rect x="152" y="229" width="12" height="10"></rect>
<rect x="208" y="229" width="12" height="10"></rect>
<rect x="280" y="229" width="12" height="10"></rect>
<rect x="352" y="229" width="12" height="10"></rect>
<rect x="400" y="229" width="28" height="10"></rect>
<rect x="152" y="302" width="12" height="10"></rect>
<rect x="208" y="302" width="12" height="10"></rect>
<rect x="280" y="302" width="12" height="10"></rect>
<rect x="352" y="302" width="12" height="10"></rect>
<rect x="400" y="302" width="28" height="10"></rect>
<rect x="152" y="348" width="12" height="28"></rect>
<rect x="208" y="348" width="12" height="28"></rect>
<rect x="280" y="348" width="12" height="28"></rect>
<rect x="352" y="348" width="12" height="28"></rect>
<rect x="400" y="348" width="28" height="28"></rect>
</g>
<g stroke="var(--accent)" stroke-width="2">
<line x1="204" y1="83" x2="204" y2="93"></line>
<line x1="204" y1="119" x2="204" y2="129"></line>
<line x1="286" y1="83" x2="286" y2="93"></line>
<line x1="286" y1="119" x2="286" y2="129"></line>
<line x1="368" y1="83" x2="368" y2="93"></line>
<line x1="368" y1="119" x2="368" y2="129"></line>
<line x1="396" y1="83" x2="396" y2="93"></line>
<line x1="396" y1="119" x2="396" y2="129"></line>
<line x1="432" y1="83" x2="432" y2="93"></line>
<line x1="432" y1="119" x2="432" y2="129"></line>
<line x1="135" y1="152" x2="145" y2="152"></line>
<line x1="171" y1="152" x2="181" y2="152"></line>
<line x1="135" y1="234" x2="145" y2="234"></line>
<line x1="171" y1="234" x2="181" y2="234"></line>
<line x1="135" y1="316" x2="145" y2="316"></line>
<line x1="171" y1="316" x2="181" y2="316"></line>
<line x1="135" y1="344" x2="145" y2="344"></line>
<line x1="171" y1="344" x2="181" y2="344"></line>
<line x1="135" y1="380" x2="145" y2="380"></line>
<line x1="171" y1="380" x2="181" y2="380"></line>
</g>
<g fill="var(--accent)">
<polygon points="204,148.5 207.5,152 204,155.5 200.5,152"></polygon>
<polygon points="286,148.5 289.5,152 286,155.5 282.5,152"></polygon>
<polygon points="368,148.5 371.5,152 368,155.5 364.5,152"></polygon>
<polygon points="396,148.5 399.5,152 396,155.5 392.5,152"></polygon>
<polygon points="432,148.5 435.5,152 432,155.5 428.5,152"></polygon>
<polygon points="204,230.5 207.5,234 204,237.5 200.5,234"></polygon>
<polygon points="286,230.5 289.5,234 286,237.5 282.5,234"></polygon>
<polygon points="368,230.5 371.5,234 368,237.5 364.5,234"></polygon>
<polygon points="396,230.5 399.5,234 396,237.5 392.5,234"></polygon>
<polygon points="432,230.5 435.5,234 432,237.5 428.5,234"></polygon>
<polygon points="204,312.5 207.5,316 204,319.5 200.5,316"></polygon>
<polygon points="286,312.5 289.5,316 286,319.5 282.5,316"></polygon>
<polygon points="368,312.5 371.5,316 368,319.5 364.5,316"></polygon>
<polygon points="396,312.5 399.5,316 396,319.5 392.5,316"></polygon>
<polygon points="432,312.5 435.5,316 432,319.5 428.5,316"></polygon>
<polygon points="204,340.5 207.5,344 204,347.5 200.5,344"></polygon>
<polygon points="204,376.5 207.5,380 204,383.5 200.5,380"></polygon>
<polygon points="286,340.5 289.5,344 286,347.5 282.5,344"></polygon>
<polygon points="286,376.5 289.5,380 286,383.5 282.5,380"></polygon>
<polygon points="368,340.5 371.5,344 368,347.5 364.5,344"></polygon>
<polygon points="368,376.5 371.5,380 368,383.5 364.5,380"></polygon>
<polygon points="396,340.5 399.5,344 396,347.5 392.5,344"></polygon>
<polygon points="396,376.5 399.5,380 396,383.5 392.5,380"></polygon>
<polygon points="432,340.5 435.5,344 432,347.5 428.5,344"></polygon>
<polygon points="432,376.5 435.5,380 432,383.5 428.5,380"></polygon>
</g>
<g stroke="var(--text-muted)">
<line x1="448" y1="106" x2="464" y2="106"></line>
<line x1="448" y1="362" x2="464" y2="362"></line>
</g>
<text x="472" y="102" font-size="12" fill="var(--text)">맨 위 줄: 가로 앵커만 바꿉니다</text>
<text x="472" y="120" font-size="12" fill="var(--text-muted)">세로는 지금 설정 그대로</text>
<text x="472" y="180" font-size="12" fill="var(--text)">맨 왼쪽 칸: 세로 앵커만 바꿉니다</text>
<text x="472" y="198" font-size="12" fill="var(--text-muted)">가로는 지금 설정 그대로</text>
<text x="472" y="252" font-size="12" fill="var(--text)">나머지 칸: 가로 하나 × 세로 하나</text>
<text x="472" y="270" font-size="12" fill="var(--text-muted)">예) 오른쪽 위는 top · right</text>
<text x="472" y="358" font-size="12" fill="var(--accent)">stretch × stretch</text>
<text x="472" y="376" font-size="12" fill="var(--text-muted)">부모를 꽉 채우는 앵커</text>
<g fill="var(--accent)"><polygon points="28,398 32,402 28,406 24,402"></polygon></g>
<text x="38" y="406" font-size="12" fill="var(--text-muted)">앵커 자리</text>
<line x1="118" y1="396" x2="118" y2="408" stroke="var(--accent)" stroke-width="2"></line>
<text x="128" y="406" font-size="12" fill="var(--text-muted)">한 방향만 정한 앵커</text>
</svg>
<figcaption>Unity 의 앵커 프리셋 창을 옮겨 그렸습니다. 칸마다 바깥 네모가 부모, 안쪽 네모가 요소입니다.</figcaption>
</figure>

읽는 법은 단순합니다.

- **칸 하나가 가로 하나와 세로 하나의 조합** 입니다. 오른쪽 위에 붙는 설정 버튼이면 top 줄의 right 칸입니다
- **맨 위 줄은 가로만, 맨 왼쪽 칸은 세로만** 바꿉니다. 한쪽 방향은 이미 맞춰 두었을 때 씁니다
- **stretch 는 앵커를 벌린 것** 입니다. 가로 stretch 면 Left, Right 가, 세로 stretch 면 Top, Bottom 이 나옵니다
- **오른쪽 아래 칸** 은 가로세로 모두 stretch 라서 부모를 꽉 채우는 앵커입니다

### Shift 와 Alt

창 위에 **Shift: Also set pivot, Alt: Also set position** 이라고 적혀 있습니다. 누른 채로 칸을 고르면 앵커 말고도 더 바꿔 줍니다.

<figure class="diagram">
<svg viewBox="0 0 680 230" role="img" aria-label="오른쪽 위 프리셋을 고를 때 그냥 누르면 앵커만, Shift 는 피벗도 옮기고, Alt 는 버튼 가장자리를 모서리에 붙이는데 Alt 만 누르면 피벗이 가운데라 너비가 늘 때 오른쪽이 부모 밖으로 나가고 Shift 와 Alt 를 같이 누르면 안쪽으로 자란다는 그림">
<text x="17" y="22" font-size="12" fill="var(--text-muted)">가운데 앵커, 가운데 피벗인 버튼에 top · right 프리셋을 고를 때</text>
<text x="17" y="48" font-size="12" fill="var(--text)">그냥 클릭</text>
<rect x="17" y="62" width="130" height="90" rx="3" stroke="var(--border)" fill="var(--bg)"></rect>
<rect x="35" y="96" width="44" height="22" rx="3" stroke="var(--text-muted)" fill="var(--bg)"></rect>
<g fill="var(--accent)"><polygon points="147,55 154,62 147,69 140,62"></polygon></g>
<circle cx="57" cy="107" r="3.5" stroke="var(--warn)" stroke-width="2" fill="var(--bg)"></circle>
<text x="17" y="176" font-size="12" fill="var(--text)">앵커만 옮깁니다</text>
<text x="17" y="194" font-size="12" fill="var(--text-muted)">버튼과 피벗은 제자리</text>
<text x="189" y="48" font-size="12" fill="var(--text)">Shift + 클릭</text>
<rect x="189" y="62" width="130" height="90" rx="3" stroke="var(--border)" fill="var(--bg)"></rect>
<rect x="207" y="96" width="44" height="22" rx="3" stroke="var(--text-muted)" fill="var(--bg)"></rect>
<g fill="var(--accent)"><polygon points="319,55 326,62 319,69 312,62"></polygon></g>
<circle cx="251" cy="96" r="3.5" stroke="var(--warn)" stroke-width="2" fill="var(--bg)"></circle>
<text x="189" y="176" font-size="12" fill="var(--text)">피벗도 모서리로</text>
<text x="189" y="194" font-size="12" fill="var(--text-muted)">버튼은 제자리</text>
<text x="361" y="48" font-size="12" fill="var(--text)">Alt + 클릭</text>
<rect x="361" y="62" width="130" height="90" rx="3" stroke="var(--border)" fill="var(--bg)"></rect>
<rect x="437" y="62" width="64" height="22" rx="3" stroke="var(--warn)" stroke-dasharray="3 3" fill="none"></rect>
<rect x="447" y="62" width="44" height="22" rx="3" stroke="var(--text-muted)" fill="var(--bg)"></rect>
<g fill="var(--accent)"><polygon points="491,55 498,62 491,69 484,62"></polygon></g>
<circle cx="469" cy="73" r="3.5" stroke="var(--warn)" stroke-width="2" fill="var(--bg)"></circle>
<text x="361" y="176" font-size="12" fill="var(--text)">가장자리를 앵커에 붙임</text>
<text x="361" y="194" font-size="12" fill="var(--text-muted)">늘면 오른쪽이 밖으로</text>
<text x="533" y="48" font-size="12" fill="var(--text)">Shift + Alt + 클릭</text>
<rect x="533" y="62" width="130" height="90" rx="3" stroke="var(--border)" fill="var(--bg)"></rect>
<rect x="599" y="62" width="64" height="22" rx="3" stroke="var(--accent)" stroke-dasharray="3 3" fill="none"></rect>
<rect x="619" y="62" width="44" height="22" rx="3" stroke="var(--accent)" fill="var(--accent-soft)"></rect>
<g fill="var(--accent)"><polygon points="663,55 670,62 663,69 656,62"></polygon></g>
<circle cx="663" cy="62" r="3.5" stroke="var(--warn)" stroke-width="2" fill="var(--bg)"></circle>
<text x="533" y="176" font-size="12" fill="var(--text)">피벗도 옮기고 붙임</text>
<text x="533" y="194" font-size="12" fill="var(--text-muted)">늘면 안쪽으로 자람</text>
<g fill="var(--accent)"><polygon points="22,210 26,214 22,218 18,214"></polygon></g>
<text x="32" y="218" font-size="12" fill="var(--text-muted)">앵커</text>
<circle cx="80" cy="214" r="4" stroke="var(--warn)" stroke-width="2" fill="var(--bg)"></circle>
<text x="90" y="218" font-size="12" fill="var(--text-muted)">피벗</text>
<rect x="132" y="208" width="18" height="12" rx="2" stroke="var(--text-muted)" stroke-dasharray="3 3" fill="none"></rect>
<text x="156" y="218" font-size="12" fill="var(--text-muted)">글자가 길어져 너비가 늘었을 때</text>
</svg>
<figcaption>같은 top · right 칸을 네 가지 방법으로 골랐습니다. 모서리에 붙일 때는 Shift 와 Alt 를 같이 누릅니다.</figcaption>
</figure>

- **그냥 누르면 앵커만** 바뀝니다. 요소는 화면상 제자리에 있고, Pos 숫자만 새 앵커 기준으로 다시 계산됩니다
- **Shift** 를 누르면 **피벗도** 그 칸의 자리로 옮깁니다. top · right 면 피벗이 요소의 오른쪽 위로 갑니다
- **Alt** 를 누르면 **위치도** 옮깁니다. 요소의 가장자리를 앵커에 붙입니다. top · right 면 요소의 오른쪽 위 모서리가 부모의 오른쪽 위 모서리에 닿고, center 면 요소의 가운데가 붙습니다

Alt 만 눌러도 겉보기에는 모서리에 딱 붙습니다. **차이는 피벗에 남습니다.**

Alt 만 누르면 피벗이 가운데에 남아 있어서, 44 × 22 버튼이라면 Pos 가 **(-22, -11)** 처럼 크기의 절반 값이 됩니다.
나중에 버튼 글자가 길어져 너비가 늘면 양쪽으로 자라니 **오른쪽이 부모 밖으로 나갑니다.**
Shift 까지 같이 누르면 피벗이 오른쪽 위로 가서 Pos 가 **(0, 0)** 이 되고, 너비가 늘어도 왼쪽으로만 자랍니다.
**모서리에 붙이는 요소는 Shift 와 Alt 를 같이** 누르는 것이 기본입니다.

stretch 칸에서 Alt 를 누르면 여백이 전부 0 이 됩니다.
그래서 **Shift 와 Alt 를 누른 채 오른쪽 아래 칸** 을 고르면 부모를 꽉 채우는 설정이 한 번에 끝납니다. 배경과 딤을 깔 때 제일 자주 쓰는 조합입니다.

## 시안을 넘길 때 적어 주면 좋은 것

| 적어 줄 것 | 무엇이 정해지나 |
| --- | --- |
| 요소가 **화면 어느 모서리나 가장자리에 붙어 있는지** | 앵커 |
| 화면이 넓어질 때 **늘어나는 것과 그대로인 것** | 앵커를 벌릴지 |
| **모서리에서 떨어진 여백** (위에서 40, 오른쪽에서 24) | Pos 또는 Left, Right, Top, Bottom |
| 내용이 늘어날 때 **어느 방향으로 자라는지** | 피벗 |
| 크기가 바뀌는 연출의 **중심** | 피벗 |

이 표의 위 세 줄은 Figma 컨스트레인트를 걸어 두는 것으로 대부분 전달됩니다.
아래 두 줄은 컨스트레인트에 없는 정보라 따로 적어 줘야 합니다.

## 정리

- UI 는 RectTransform 을 쓰고, 레이아웃 크기는 **Scale 이 아니라 Width, Height** 로 정합니다
- **Pos 는 앵커에서 피벗까지의 거리** 입니다. 같은 숫자라도 앵커가 다르면 다른 자리입니다
- Unity 는 **위로 갈수록 Y 가 커집니다.** Figma 와 반대입니다
- 앵커는 부모 크기가 바뀔 때 붙잡는 자리입니다. 틀린 앵커는 기준 화면에서는 안 보이고 다른 비율에서 드러납니다
- 앵커를 벌리면 크기 대신 **여백을 적고**, 요소는 부모를 따라 늘어납니다
- Figma 컨스트레인트와 Unity 앵커는 일대일로 옮겨집니다
- 피벗은 **회전, 크기, Scale 의 중심** 이고, 내용이 자라는 방향을 보고 정합니다