> 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/scene-editor/interactivity/states-and-conditions.md).

# 상태 및 조건

아이템 상태 및 조건부 로직 관리

{% embed url="<https://www.youtube.com/watch?v=wm8ZD2kSyKA>" %}

## 조건부 로직

트리거에 조건을 추가하면 해당 조건이 충족될 때만 동작이 실행됩니다. 예를 들어 문이 이미 열려 있지 않은 경우에만 문을 클릭했을 때 "열기" 동작이 실행되도록 할 수 있습니다.

조건을 추가하려면 다음 항목 옆의 점 3개 아이콘을 클릭하세요. **트리거 이벤트** 을 선택한 다음 **트리거 조건 추가**.

![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-b2775405d3a1e158daf49e89b0b1e7af8f44ce40%2Fcondition.webp?alt=media)

하나의 트리거에 여러 조건을 포함할 수 있습니다. 다음 아이콘을 클릭해 **+** 조건을 추가하세요. 조건이 두 개 이상이면 다음 옵션 중 하나를 선택할 수 있습니다.

* **모든 조건 충족(AND)**: 모든 조건이 참일 때만 트리거가 실행됩니다.
* **조건 중 하나라도 충족(OR)** 조건 중 하나 이상이 참이면 트리거가 실행됩니다.

![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-ea7940d5ed373be8d0845709468df96aa47e875c%2Fmultiple-conditions.webp?alt=media)

### 상태

여러 스마트 아이템에는 **상태** 구성 요소가 포함되어 있습니다. 이 구성 요소에는 스마트 아이템이 취할 수 있는 상태가 나열됩니다. 스마트 아이템은 언제나 이 상태 중 하나에 있습니다. 예를 들어 문은 *열림* 또는 *닫힘*상태일 수 있습니다. 열기 동작은 상태를 *열림*으로 설정하고, 닫기 동작은 상태를 *닫힘*.

상태를 사용해 다음 작업을 수행할 수 있습니다.

1. 트리거에 조건을 사용해 엔티티의 상태를 확인할 수 있습니다. 이렇게 하면 특정 상태가 활성화된 경우에만 동작이 실행됩니다.

![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-b2775405d3a1e158daf49e89b0b1e7af8f44ce40%2Fcondition.webp?alt=media)

2. 상태는 **상태 설정** 동작을 통해 변경할 수 있습니다.

![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-c1a1bebf1536c6d3e8bf25cd9164aef651b9d9a9%2Fset-state.webp?alt=media)

3. 상태 변화에는 **상태 변경 시** 트리거 이벤트를 통해 반응할 수 있습니다.

두 동작을 번갈아 실행하려면 트리거를 두 개 정의하고, 각 트리거에 상태를 확인하는 조건을 설정하세요. 예를 들어 문에는 열기 동작을 실행하는 트리거와 문 상태가 먼저 *닫힘*인지 확인하는 조건이 있고, 닫기 동작을 실행하는 다른 트리거에는 문 상태가 *열림*인지 확인하는 조건이 있습니다. 플레이어가 문을 클릭할 때마다 두 트리거 중 하나만 실행됩니다.

![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-4cc97917b39c5abf24309ea1ff45021d652282db%2Fdoor_conditions.webp?alt=media)

스마트 아이템에 원하는 만큼 상태를 추가할 수 있습니다. 목록에 상태를 추가하려면 **새 상태 추가** 버튼을 클릭하세요.

![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-2eae40fd0b8eb62479d4a87fde4cc9f87e1c7631%2Fnew_state.webp?alt=media)

상태 중 하나가 기본값으로 선택되며, 씬이 실행될 때 아이템은 항상 이 상태로 시작합니다. 다른 상태 옆의 점 3개를 클릭하고 **기본값으로 설정**.

{% hint style="info" %}
**💡 팁**: 아이템 간 상호작용은 단순하게 유지하세요. 예를 들어 버튼이 세 가지 동작, 즉 문 애니메이션 재생, 문 소리 재생, 문 상태 변경을 실행해 문을 열도록 하는 방식은 피하세요. 대신 버튼이 문의 상태를 변경하도록 하세요. 그런 다음 **상태 변경 시** 트리거를 사용하면 상태가 바뀔 때마다 문 자체가 애니메이션과 소리를 재생하도록 할 수 있습니다.
{% endhint %}

### 카운터

카운터를 추적하려면 **카운터** 구성 요소를 사용하세요. 플레이어가 씬에서 동작을 수행하면 카운터 값이 바뀔 수 있습니다. 조건부 로직에서 카운터 값을 사용할 수 있습니다.

엔티티에 카운터 구성 요소가 있으면 다음 동작을 실행할 수 있습니다.

* **카운터 증가**: 카운터 값을 설정 가능한 값만큼 증가시킵니다. **양**, 기본값은 1입니다.
* **카운터 감소**: 설정 가능한 양만큼 카운터 값을 줄입니다 **양**, 기본값은 1입니다.
* **카운터 설정**: 카운터 값을 특정 숫자로 설정합니다. 예를 들어 0으로 되돌릴 수 있습니다.

다음을 사용해 **카운터 변경 시** 트리거를 사용하면 카운터 값이 바뀔 때마다 작업을 수행할 수 있습니다. 이 트리거에 조건을 추가해 특정 임계값을 넘은 뒤에만 활성화되도록 하세요.

![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-bd7370032dd98768db05fb39d072082cf6cd6682%2Fon_counter_change.webp?alt=media)

조건에서 카운터 값이 다음 중 무엇인지 확인할 수 있습니다.

* 지정한 값보다 큰지
* 지정한 값보다 작은지
* 지정한 값과 같은지

{% hint style="info" %}
**💡 팁**: 크거나 같은지 확인하려면 AND 옵션을 사용해 트리거 이벤트에 조건을 두 개 추가하면 됩니다.

임계값을 넘을 때 작업이 한 번만 발생하고 이후 값이 증가할 때마다 반복되지 않도록 하려면 카운터를 다음과 결합하세요: **상태** 구성 요소. 원하는 값에 도달할 때마다 상태를 "완료"로 설정하고, 트리거 이벤트에 이 상태를 확인하는 조건을 추가하세요.
{% endhint %}

### 관련 항목

* [스마트 아이템 - 기본](https://docs.decentraland.org/creator/content-creator-ko/scene-editor/interactivity/smart-items.md)
* [스마트 아이템 - 고급](https://docs.decentraland.org/creator/content-creator-ko/scene-editor/interactivity/smart-items-advanced.md)
* [모든 아이템을 스마트하게 만들기](https://docs.decentraland.org/creator/content-creator-ko/scene-editor/interactivity/make-any-item-smart.md)
* [코드와 결합](https://docs.decentraland.org/creator/content-creator-ko/scene-editor/extend-with-code/overview.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/scene-editor/interactivity/states-and-conditions.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.
