> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/creator/content-creator-ko/build-for-mobile/develop/safe-area.md).

# 모바일 안전 영역

씬 UI가 모바일에서 안전하게 배치될 수 있는 영역 — 기기의 하드웨어 여백과 클라이언트 자체 컨트롤을 피한 곳.

휴대폰에서 UI가 안전하게 사용할 수 있는 화면 공간은 서로 관련 없는 두 가지 요소로 인해 줄어듭니다.

* **기기의 하드웨어 여백**  — 노치나 카메라 컷아웃, 상태 표시줄, 홈 인디케이터, 둥근 모서리입니다. 이 영역 아래에 그려진 UI는 일부가 가려지거나 탭하기 어렵습니다.
* **Decentraland 클라이언트 자체의 컨트롤**  — 조이스틱, 채팅, 프로필, 카메라 컨트롤, 액션 버튼입니다. 이 영역 아래에 배치된 씬 UI는 시각적으로 겹치고 같은 탭 입력을 두고 충돌합니다.

두 영역을 직접 측정할 필요는 없습니다. 클라이언트가 런타임에 두 영역을 모두 보고하며, SDK는 선택한 영역 안에 UI를 배치합니다. 이때 사용하는 옵션은  [`screenInset`](https://docs.decentraland.org/creator/content-creator-ko/sdk7/2d-ui/onscreen-ui.md#screen-inset-area)  렌더러 옵션입니다.

| 원하는 동작                      | 전달할 값                               |
| --------------------------- | ----------------------------------- |
| 하드웨어 여백 피하기                 | 없음 —  `screenInset: 'device'` 가 기본값 |
| 하드웨어 여백 **과** 클라이언트 컨트롤 피하기 | `screenInset: 'interactable'`       |
| 전체 화면 사용, 여백은 직접 처리         | `screenInset: 'none'`               |

```ts
// 모바일 컨트롤과 겹치지 않아야 하는 씬 UI에 권장
ReactEcsRenderer.setUiRenderer(uiComponent, { screenInset: 'interactable' })
```

{% hint style="warning" %}
**클라이언트 지원**: `'interactable'` 에는 모바일 클라이언트  `1.12.1`  이상이 필요합니다. 이전 클라이언트에서는 영역이 0으로 보고되어 UI가 전체 화면을 차지합니다. 같은 릴리스에서 Android와 iOS 간  `'device'`  영역도 통일되었습니다.

**데스크톱에서도 영향을 미칩니다**  — 데스크톱 클라이언트는 자체 UI를 위해 화면 왼쪽 약 25%를 예약하므로  `'interactable'` 는 데스크톱 레이아웃도 변경합니다. 휴대폰에서만 인셋을 적용하려면  [`isMobile()`](https://docs.decentraland.org/creator/content-creator-ko/build-for-mobile/develop/detect-platform.md) 로 분기하세요.
{% endhint %}

자세한 내용은  [화면 인셋 영역](https://docs.decentraland.org/creator/content-creator-ko/sdk7/2d-ui/onscreen-ui.md#screen-inset-area) 을 참조하세요. 실제 기기에서 세 영역을 나란히 비교하고, 렌더러별 동작과 다음 항목과의 관계를 설명합니다:  [가상 화면](https://docs.decentraland.org/creator/content-creator-ko/sdk7/2d-ui/onscreen-ui.md#default-virtual-size).

## 클라이언트 컨트롤의 위치

`'interactable'` 는  **각 익스플로러가 씬 UI용으로 지정한 영역** 을 제공합니다. 다만 모든 클라이언트 컨트롤이 그 영역 밖에 있다는 보장은 없습니다. 모바일 클라이언트에서 이 영역은 기기의 안전 영역에서 왼쪽 열(채팅, 프로필, 조이스틱, 이모트)을 뺀 영역입니다. 오른쪽 아래의 액션 버튼은 의도적으로 이 영역 위에 그려집니다. 이는  **의도된 동작입니다**.

<figure><img src="https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-e68f1a62cc357cbe24e75f24c58db7d37a4f4ee2%2Fscreeninset-interactable.webp?alt=media" alt="Scene UI inset to the area the mobile client reports as free of its own HUD"><figcaption><p><code>screenInset: 'interactable'</code> 를 사용하는 모바일 클라이언트 <code>1.12.1</code>. 자홍색 사각형은 씬 UI이고, 녹색 윤곽선은 상호작용 가능 영역을 나타냅니다. 왼쪽 열은 제외되며, 오른쪽 아래의 액션 버튼은 이 영역 위에 놓입니다.</p></figcaption></figure>

따라서  `'interactable'`를 사용하더라도 다음 영역은 혼잡한 영역으로 취급하세요.

* **오른쪽 아래** — 작업 버튼과 상호작용 버튼이 위에 그려집니다. 여기에 배치한 요소도 여전히 사용할 수 있지만, 탭 입력을 두고 경쟁합니다.
* **오른쪽 위** — 프로필 및 카메라 컨트롤은 이 영역 바로 바깥에 있으므로, 이 모서리에 바짝 붙인 UI는 클라이언트 HUD의 일부처럼 보입니다.

이 영역의 범위는 각 익스플로러가 정하며 버전마다 달라질 수 있습니다. 런타임에 확인하고, 하드코딩하지 말고, 대상 플랫폼에서 확인하세요.

## 씬 UI를 배치할 위치

* **화면 중앙** — 플레이어가 읽고 응답해야 하는 대화상자 등 상호작용 가능한 요소.
* **상단 중앙** — 상호작용이 필요 없는 메시지, 상태 및 알림.
* **상호작용 버튼 위쪽 중앙 하단** — 상황에 맞는 힌트.
* **오른쪽 아래 모서리는 피하세요** — 상호작용 가능 영역 안에 있더라도 작업 버튼이 차지하는 자리입니다.

## 대신 UI의 일부만 감싸세요

다음 설정으로 인셋을 사용하지 않도록 했다면 `screenInset: 'none'` UI의 일부만 보호하려는 경우 해당 부분을 다음 컴포넌트로 감싸세요. `ScreenInsetArea` 또는 `InteractableArea` 컴포넌트를 사용하세요. 각 컴포넌트는 해당하는 영역을 읽어 자식 요소에 적용합니다. 다음에서 가져오세요. `@dcl/sdk/react-ecs`:

```tsx
import ReactEcs, { ReactEcsRenderer, UiEntity, ScreenInsetArea } from '@dcl/sdk/react-ecs'
import { Color4 } from '@dcl/sdk/math'

export function setupUi() {
  ReactEcsRenderer.setUiRenderer(() => (
    <ScreenInsetArea>
      {/* 크기가 100% × 100%인 자식 요소는 안전 인셋 영역을 정확히 채웁니다 */}
      <UiEntity
        uiTransform={{ width: '100%', height: '100%' }}
        uiBackground={{ color: Color4.create(0, 0, 0, 0.5) }}
      />
    </ScreenInsetArea>
  ), { screenInset: 'none' })
}
```

두 컴포넌트는 클라이언트가 보고하는 값을 사용해 절대 위치로 배치되므로, 해당 컴포넌트의 `positionType` 및 `position` 의 필드는 `uiTransform` 에서 예약되어 있습니다. 따라서 해당 필드에 설정한 값은 무시됩니다. 그 밖의 모든 `uiTransform` 속성(`padding`, `flexDirection`, `alignItems`, …)과 UI 컴포넌트(`uiBackground`, `onMouseDown`, …)는 평소처럼 작동합니다. 회전하거나 시스템 바가 나타나거나 사라지는 등 영역이 바뀌면 자동으로 반응하며, [UI 배율](https://docs.decentraland.org/creator/content-creator-ko/sdk7/2d-ui/onscreen-ui.md#screen-virtual-scale)도 보정하므로 가상 화면 크기에 관계없이 여백이 올바르게 적용됩니다.

{% hint style="warning" %}
**📔 인셋을 두 번 적용하지 마세요:** 위의 `screenInset: 'none'` 은 중요합니다. 렌더러도 그에 맞는 인셋을 적용하는 동안 컴포넌트로 UI를 감싸면 UI가 여백의 두 배만큼 안쪽으로 밀립니다. 둘 중 하나만 선택하세요.
{% endhint %}

{% hint style="info" %}
**📱 모바일 전용:** 기기 인셋은 실제 값이 **모바일 클라이언트**에서만 있습니다.  **데스크톱 클라이언트** 에서는 `(0, 0, 0, 0)`0 `screenInset: 'device'` 와 `ScreenInsetArea` 컴포넌트가 아무런 효과가 없으므로, 이를 사용하지 않았을 때와 똑같이 UI가 렌더링됩니다. 기기 인셋과 달리 상호작용 가능 영역은 *데스크톱에서* 0이 아닙니다.
{% endhint %}

## 중요한 이유

클라이언트 컨트롤과 겹치는 씬 UI는 다음과 같은 문제를 일으킬 수 있습니다.

* 조이스틱, 상호작용 버튼 또는 카메라 컨트롤 뒤에 일부가 가려집니다.
* 해당 컨트롤과 탭 입력을 두고 경쟁하게 되어 플레이어가 실수로 둘 중 하나를 작동시킬 수 있습니다.
* 모바일에서 씬이 제대로 작동하지 않는 듯한 느낌을 주어 추천 노출과 사용자 유지율에 악영향을 미칩니다.

항상 실제 기기에서 [미리보기 QR 코드](https://docs.decentraland.org/creator/content-creator-ko/build-for-mobile/develop/preview-on-mobile.md).

## 관련 항목

* [화면 인셋 영역](https://docs.decentraland.org/creator/content-creator-ko/sdk7/2d-ui/onscreen-ui.md#screen-inset-area) — 전체 `screenInset` 참조 문서를 확인하세요.
* [모바일 UI 모범 사례](https://docs.decentraland.org/creator/content-creator-ko/build-for-mobile/develop/ui-best-practices.md)
* [코드에서 플랫폼 감지](https://docs.decentraland.org/creator/content-creator-ko/build-for-mobile/develop/detect-platform.md) —  `isMobile()` 을 사용해 레이아웃을 전환하세요.
* [화면 UI](https://docs.decentraland.org/creator/content-creator-ko/sdk7/2d-ui/onscreen-ui.md)
* [UX 및 UI 가이드](https://docs.decentraland.org/creator/content-creator-ko/sdk7/designing-the-experience/ux-ui-guide.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.decentraland.org/creator/content-creator-ko/build-for-mobile/develop/safe-area.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
