> 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/sdk7/getting-started/sdk-101.md). Agents can also search and read this documentation through its [MCP server](https://docs.decentraland.org/~gitbook/mcp).

# SDK 빠른 시작

공식 SDK Skills를 사용한 AI 지원 바이브 코딩과 Creator Hub, SDK로 첫 Decentraland 씬을 만드세요.

이 튜토리얼에서는 Creator Hub의 시각적 Scene Editor, Decentraland SDK를 사용한 직접 작성 코드, AI를 활용한 **바이브 코딩**. 이 세 가지를 함께 사용하면서 각각 어떤 상황에서 유용한지 알아봅니다.

## Decentraland 씬은 어떻게 만드나요?

1. **씬을 만들고, 미리 보고, 게시할 수 있는 공식 데스크톱 앱인** [**Creator Hub**](https://decentraland.org/download/creator-hub),를 설치하세요. 모든 수준의 크리에이터에게 권장되는 도구입니다.
2. **AI 코딩 어시스턴트** (Claude Code, Cursor, Copilot 등)를 사용한다면 공식 [Decentraland SDK Skills](https://docs.decentraland.org/creator/content-creator-ko/sdk7/getting-started/vibe-coding.md) 검증된 SDK7 패턴을 알 수 있도록 다음을 실행합니다: `npx skills add decentraland/sdk-skills`
3. **이** [**CLI**](https://docs.decentraland.org/creator/content-creator-ko/sdk7/getting-started/using-the-cli.md) 는 고급 사용자와 자동화된 워크플로를 위한 대안입니다.

이 튜토리얼의 나머지 부분에서는 권장 경로를 단계별로 안내합니다.

## Creator Hub 설치

Creator Hub를 사용하면 Decentraland 씬을 만들고, 미리 보고, 배포할 수 있습니다. Creator Hub를 다운로드하세요. [여기](https://decentraland.org/download/creator-hub).

씬 코드를 편집하려면 코드 편집기도 필요합니다. [Visual Studio Code](https://code.visualstudio.com/) 및 [Cursor](https://www.cursor.com/) 둘 다 훌륭한 선택이지만, 어떤 코드 편집기를 사용해도 괜찮습니다.

자세한 내용은 [설치 가이드](https://docs.decentraland.org/creator/content-creator-ko/scene-editor/get-started/editor-installation.md) 를 참조하세요.

## 첫 장면 만들기

1. Creator Hub를 엽니다.
2. 다음을 선택합니다 **장면** 탭을 클릭합니다. **새 장면**.

   ![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-e5671a1706f73b79a9baffeda0c81d5d9e4cb53d%2Fnew-scene.webp?alt=media)
3. 시작 템플릿을 선택합니다. 이 연습에서는 다음을 선택합니다. **빈 장면**.

이 단계는 몇 분 정도 걸릴 수 있습니다. 기본 장면에 필요한 기본 파일 세트가 폴더에 추가됩니다. 작업이 완료되면 장면의 빈 격자가 표시됩니다.

## 에셋 팩에서 항목 추가하기

장면 편집기 하단에 있는 **에셋 팩** 을 살펴보고 항목 몇 개를 장면으로 끌어다 놓습니다. 지금은 어떤 항목이든 괜찮습니다.

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

이미 배치된 항목을 클릭한 후 드래그하여 위치를 조정할 수 있습니다. 자세한 내용은 [씬 편집기 기본 사항](https://docs.decentraland.org/creator/content-creator-ko/scene-editor/get-started/scene-editor-essentials.md#position-items) 을 참조하세요.

{% hint style="info" %}
**💡 팁**: 씬 전체를 바닥 항목으로 덮으세요. 유형이 **바닥** 인 항목에는 페인트 통 아이콘이 표시됩니다. 이러한 항목을 씬으로 드래그하면 씬의 바닥 전체가 해당 항목의 복사본으로 채워집니다.

<img src="https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-98bc75e11e441e06ff960c54f1f6c5aad7e3a15f%2Fground.webp?alt=media" alt="Ground" data-size="original">
{% endhint %}

## 미리보기 실행

다음 **재생** 상단 메뉴의 버튼을 클릭해 Decentraland에서 씬을 불러옵니다. 이제 Decentraland 아바타로 씬을 탐험할 수 있습니다.

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

작업하는 동안 미리 보기 창을 열어 두어도 됩니다. 변경할 때마다 미리 보기가 업데이트됩니다. 자세한 내용은 다음에서 확인하세요. [씬 미리 보기](https://docs.decentraland.org/creator/content-creator-ko/sdk7/getting-started/preview-scene.md).

## 사용자 지정 3D 에셋

아보카도 3D 모델을 다음에서 다운로드하세요. *glb* 형식의 파일을 아래 [링크](https://github.com/decentraland-scenes/avocado/raw/main/avocado-glb.zip) 에서 다운로드한 뒤 압축을 풉니다.

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

파일 탐색기에서 **avocado.glb** 파일을 Scene Editor의 하단 패널(다음 항목이 있는 패널)에 끌어다 놓고 **에셋 팩** 및 **로컬 에셋** 탭이 있는 패널)에서 **가져오기**.

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

이제 **avocado.glb** 모델을 **로컬 에셋** 탭의 **씬** 폴더에서 찾을 수 있습니다. 에셋 팩의 항목처럼 파일을 씬으로 끌어다 놓으세요.

![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-0091f4323556b933ae81eba77e60eb639169b2a5%2Favocado-in-local-assets.webp?alt=media)

## 씬 코드 편집

상단 메뉴에서 **<> 코드** 버튼을 클릭해 코드 편집기에서 씬 프로젝트를 엽니다.

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

{% hint style="warning" %}
**📔 참고**: 아무것도 열리지 않으면 [Visual Studio Code](https://code.visualstudio.com/) 또는 [Cursor](https://www.cursor.com/) 와 같은 코드 편집기가 설치되어 있는지 확인하세요.
{% endhint %}

코드 편집기의 왼쪽 여백에서 프로젝트의 파일 및 폴더 구조를 탐색할 수 있습니다. `index.ts` 파일을 `src` 폴더에서 여세요. 파일 내용은 다음과 같아야 합니다.

```ts
import {} from '@dcl/sdk/math'
import { engine } from '@dcl/sdk/ecs'

export function main() {}
```

Decentraland 씬은 [TypeScript](https://www.typescriptlang.org/)로 작성되며, Decentraland SDK를 사용합니다. 이 라이브러리에는 3D 콘텐츠 배치, 상호작용 추가, 씬에서 발생하는 동작 제어에 필요한 모든 것이 들어 있습니다.

이 파일은 `main()`이라는 함수를 정의합니다. 이 함수는 씬의 진입점으로, 여기에 작성한 코드는 씬이 처음 로드될 때 실행됩니다.

시각 편집기를 사용해 아보카도 하나를 씬에 이미 끌어다 놓았습니다. 이번에는 코드를 작성해 두 번째 아보카도를 추가해 보겠습니다. 먼저 `index.ts` 다음이 포함된 파일:

```ts
import { Vector3 } from '@dcl/sdk/math'
import { engine, Transform, GltfContainer } from '@dcl/sdk/ecs'

export function main() {
	// 새 Entity 생성
	let avocado2 = engine.addEntity()

	// Transform 추가
	Transform.create(avocado2, {
		position: Vector3.create(8, 0, 8),
	})

	// GLTF 추가
	GltfContainer.create(avocado2, {
		src: 'assets/scene/avocado.glb',
	})
}
```

이 코드는 새 [엔터티](https://docs.decentraland.org/creator/content-creator-ko/sdk7/architecture/entities-components.md), 다운로드한 3D 모델을 기반으로 [셰이프](https://docs.decentraland.org/creator/content-creator-ko/sdk7/3d/shape-components.md) 을 지정하고, [위치를 설정](https://docs.decentraland.org/creator/content-creator-ko/sdk7/3d/entity-positioning.md) 합니다. 이때 **Transform** 컴포넌트를 사용합니다.

일반적으로 `index.ts` 에 작성하는 코드는 모두 `main()` 안에 있어야 합니다(또는 main에서 간접적으로 참조하는 다른 함수 안에 있어야 합니다). 자세한 내용은 [씬 수명 주기](https://docs.decentraland.org/creator/content-creator-ko/sdk7/getting-started/coding-scenes.md#scene-lifecycle) 를 참조하세요.

씬 미리보기를 실행하세요. 이제 Scene Editor에서 추가한 아보카도 하나와 코드로 추가한 아보카도 하나, 총 두 개가 표시됩니다.

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

{% hint style="warning" %}
**📔 참고**: 두 번째 아보카도는 **코드에만 존재합니다**. 씬을 실행하면 표시되지만, Scene Editor 캔버스와 엔터티 트리에는 `index.ts`에서 생성한 엔터티가 표시되지 않습니다. 편집기에서 보이지 않더라도 걱정하지 마세요. 시각적 편집과 코드를 함께 사용할 때 기억해야 할 중요한 점입니다.
{% endhint %}

두 아보카도는 같은 구성 요소로 만들어집니다. Scene Editor에서 **첫 번째** 아보카도를 선택하세요. 속성 패널에는 코드에서 방금 작성한 것과 같은 종류의 필드가 있는 **Transform** 과 **GltfContainer** 컴포넌트가 표시됩니다. 두 가지는 같은 대상을 서로 다른 방식으로 보여 줍니다.

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

## Script로 상호작용 추가하기

플레이어에게 반응하도록 아보카도를 만들어 보겠습니다. 이미 편집 중인 `index.ts` 에 코드를 추가해도 되지만, 대신 **Script 컴포넌트**를 사용해 보겠습니다. Scene Editor의 항목에 코드를 직접 연결하는 방법입니다. 각 항목의 동작을 독립적으로 관리할 수 있고, 하나의 스크립트를 여러 항목에서 재사용할 수도 있습니다.

1. Scene Editor에서 첫 번째 아보카도(직접 끌어다 놓은 아보카도)를 선택하세요. 코드로만 생성한 아보카도는 여기에 표시되지 않는다는 점을 기억하세요.
2. 클릭하세요 **+** 속성 패널 상단의 버튼을 클릭하고 **스크립트** 를 선택해 Script 컴포넌트를 추가합니다.
3. 클릭합니다 **+ 새 스크립트 만들기** 이름을 지정합니다 `AvocadoScript`.

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

4. 다음 항목의 **<> 코드** 버튼을 클릭하면 Script 컴포넌트의 새 파일이 코드 편집기에서 열립니다.

스크립트는 세 가지 주요 부분으로 구성된 클래스입니다(간결하게 하기 위해 주석은 생략했습니다).

```ts
import { engine, Entity } from '@dcl/sdk/ecs'
import {} from '@dcl/sdk/math'

export class AvocadoScript {
	constructor(
		public src: string, // 제거하지 마세요
		public entity: Entity, // 제거하지 마세요
		// 아래에 사용자 지정 입력을 추가하세요
	) {}

	start() {
		// 씬이 로드될 때 한 번 호출됩니다
	}

	update(dt: number) {
		// 매 프레임마다 호출됩니다
	}
}
```

* 이 **생성자** 는 Creator Hub의 Script 컴포넌트에 편집 가능한 필드로 표시되는 매개변수를 정의합니다. 다음을 제거하지 마세요. `src` 또는 `entity`.
* **`start()`** 은 실행됩니다 **한 번** 장면이 로드될 때 실행됩니다. 컴포넌트 생성, 클릭 핸들러 등록 등의 초기 설정에 사용하세요.
* **`update(dt)`** 다음 시점에 실행됩니다. **게임의 매 프레임마다** 엔진이 렌더링하는 속도와 동일한 빈도로 실행됩니다(예: 60 FPS에서는 초당 60회). 이동과 같은 연속적인 동작에 사용하세요. `dt` 에는 마지막 프레임 이후 경과한 시간이 초 단위로 담깁니다.

클래스 내부에서 `this.entity` 는 항상 Script 컴포넌트를 포함하는 엔티티를 가리킵니다. 이 경우에는 아보카도입니다. 덕분에 스크립트를 재사용할 수 있습니다. 같은 스크립트를 아이템 10개에 연결하면 각 아이템이 자기 자신에게 작동합니다.

### 첫 상호작용을 바이브 코딩으로 만들어 보세요

다음 코드를 직접 작성할 수도 있지만, 지금이 바로 **바이브 코딩**: AI 어시스턴트에게 원하는 것을 설명하고 코드를 작성하게 하는 방식을 시도해 보기 좋습니다. 대부분의 코드 편집기에는 Cursor의 채팅, VS Code의 GitHub Copilot, 또는 [Claude Code](https://claude.com/product/claude-code) 같은 도구가 기본으로 내장되어 있습니다. Claude Desktop이나 명령줄의 Claude Code처럼 코드 편집기 밖에서 프롬프트를 작성할 수도 있습니다.

첫 프롬프트를 작성하기 전에 Decentraland SDK 스킬을 설치하세요. 그러면 AI가 SDK의 패턴을 파악해 실수를 훨씬 줄일 수 있습니다.

```bash
npx skills add decentraland/sdk-skills
```

이 스킬은 AI가 SDK를 사용해 작업하는 방법을 모를 때 참고하는 문서입니다. 따라서 추측하는 대신 올바른 코드를 작성할 수 있습니다. 자세한 내용은 [AI와 함께하는 바이브 코딩](https://docs.decentraland.org/creator/content-creator-ko/sdk7/getting-started/vibe-coding.md) 설정 옵션과 프롬프트 작성 팁을 확인하세요.

이제 다음과 같은 프롬프트를 입력해 보세요.

> AvocadoScript.ts에서 플레이어가 아보카도를 클릭하면 콘솔에 메시지를 기록하도록 해 줘.

다음과 같은 코드가 생성될 거예요(또는 직접 붙여 넣어도 됩니다).

```ts
import { engine, Entity, pointerEventsSystem, InputAction } from '@dcl/sdk/ecs'
import {} from '@dcl/sdk/math'

export class AvocadoScript {
	constructor(
		public src: string,
		public entity: Entity,
	) {}

	start() {
		pointerEventsSystem.onPointerDown(
			{
				entity: this.entity,
				opts: { button: InputAction.IA_POINTER },
			},
			() => {
				console.log('CLICKED AVOCADO')
			}
		)
	}

	update(dt: number) {}
}
```

다음 코드가 `start()` 함수 안에 클릭 동작을 추가했어요. 클릭 동작은 한 번만 정의하면 되고, 플레이어가 아이템을 클릭할 때마다 실행됩니다.  `pointerEventsSystem.onPointerDown()` 문은 다음 세 가지를 정의합니다.

* 클릭 이벤트가 적용될 `entity` 는 무엇인지: 여기서는 `this.entity`이며, 스크립트가 연결된 아보카도입니다.
* 하나의 `opts` 객체: 사용할 버튼과 지금은 사용하지 않는 기타 선택적 인수입니다.
* 엔티티를 클릭할 때마다 실행되는 함수입니다.

로그에 기록된 메시지를 보려면 미리 보기를 실행하고 오른쪽 위 모서리의 ![](https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-a673f6b987216e9e471fdac882879c44fcf94652%2Fconsole-icon.png?alt=media\&token=1965a51b-d4b0-4caa-b9d5-d24d738c1fb8) 아이콘을 클릭해 콘솔을 여세요.  **\`** 키를 눌러 콘솔을 표시하거나 숨길 수도 있습니다. 아보카도를 클릭할 때마다 새 줄이 표시됩니다.

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

{% hint style="warning" %}
**📔 참고**: 엔티티를 클릭할 수 있으려면 충돌체 지오메트리가 있어야 합니다. 여기서 사용하는 모델에는 충돌체가 이미 포함되어 있습니다. 충돌체가 없는 모델의 해결 방법은 [충돌체](https://docs.decentraland.org/creator/content-creator-ko/3d/colliders.md) 를 참조하세요.
{% endhint %}

### 아보카도를 사라지게 하기

이제 클릭했을 때 더 재미있는 일이 일어나도록 해 봅시다! AI 어시스턴트에게 다음과 같이 요청하세요.

> 아보카도를 클릭하면 사라지게 해 줘. 작아지면서 통통 튀는 애니메이션과 함께 사라졌으면 좋겠어. 그리고 아보카도 위에 포인터를 올렸을 때 표시되는 힌트는 "수집"으로 바꿔 줘.

다음과 같은 코드가 생성될 거예요.

```ts
import { engine, Entity, pointerEventsSystem, InputAction, Tween, EasingFunction } from '@dcl/sdk/ecs'
import { Vector3 } from '@dcl/sdk/math'

export class AvocadoScript {
	constructor(
		public src: string,
		public entity: Entity,
	) {}

	start() {
		pointerEventsSystem.onPointerDown(
			{
				entity: this.entity,
				opts: { button: InputAction.IA_POINTER, hoverText: 'Collect' },
			},
			() => {
				this.collect()
			}
		)
	}

	collect() {
		Tween.setScale(
			this.entity,
			Vector3.One(),
			Vector3.Zero(),
			500,
			EasingFunction.EF_EASEINBOUNCE
		)
	}

	update(dt: number) {}
}
```

AI가 작성한 내용을 자세히 살펴보겠습니다.

* 통통 튀는 애니메이션을 만들기 위해 **Tween**을 사용했어요. 트윈은 시간의 흐름에 따라 엔티티의 위치, 회전 또는 크기를 점진적으로 바꾸는 동작을 나타냅니다. 여기서 `Tween.setScale()` 아보카도를 원래 크기(`Vector3.One()`)에서 아무것도 없는 상태(`Vector3.Zero()`)로 500밀리초 동안 줄이며, 통통 튀는 이징 곡선을 사용합니다. 트윈에 대해 자세히 알아보려면 [엔티티 이동](https://docs.decentraland.org/creator/content-creator-ko/sdk7/3d/move-entities.md).
* 트윈을 클릭 함수 안에 직접 작성하는 대신, 별도의 `collect()` 메서드를 만들었습니다. 꼭 이렇게 해야 하는 것은 아닙니다(AI가 트윈을 클릭 함수 안에 넣었더라도 괜찮습니다). 하지만 좋은 습관입니다. 메서드를 사용하면 코드를 읽기 쉽게 만들고 여러 곳에서 같은 로직을 재사용할 수 있습니다.
* 아보카도에 "수집" 힌트를 표시하기 위해 이를 `hoverText` 값으로 설정했습니다.

미리 보기를 실행하고 아보카도를 클릭해 보세요. 멋지게 사라져야 합니다.

{% hint style="warning" %}
**📔 참고**: 아보카도는 크기가 0으로 줄어들지만 엔티티는 여전히 존재합니다. 씬을 가볍게 유지하려면 트윈이 끝난 뒤 엔티티를 삭제하는 것이 좋습니다. 자세한 내용은 [트윈 완료 시](https://docs.decentraland.org/creator/content-creator-ko/sdk7/3d/move-entities.md#on-tween-finished).
{% endhint %}

### 매 프레임 코드 실행

지금까지는 모든 코드가 `start()`에서 실행되었습니다. 이제 `update()` 를 사용해 아보카도가 계속 회전하도록 하겠습니다. 생성자와 `update()` 를 다음 코드로 바꾸세요:

```ts
	constructor(
		public src: string,
		public entity: Entity,
		public speed: number = 45,
	) {}

	update(dt: number) {
		const transform = Transform.getMutable(this.entity)
		transform.rotation = Quaternion.multiply(
			transform.rotation,
			Quaternion.fromAngleAxis(this.speed * dt, Vector3.Up())
		)
	}
```

또한 파일 상단의 import에 `Transform` 과 `Quaternion` 을 추가해야 합니다. import는 다음과 같습니다:

```ts
import { engine, Entity, pointerEventsSystem, InputAction, Tween, EasingFunction, Transform } from '@dcl/sdk/ecs'
import { Vector3, Quaternion } from '@dcl/sdk/math'
```

{% hint style="info" %}
**💡 팁**: import를 직접 편집하는 대신, 코드 편집기에 표시된 오류를 클릭해 자동으로 추가할 수 있습니다.
{% endhint %}

매 프레임 아보카도를 조금씩 더 회전시킵니다. `dt` 를 곱하면 움직임이 부드럽고 프레임 속도에 영향을 받지 않습니다. 플레이어의 컴퓨터가 얼마나 빠르게 실행되든 아보카도는 초당 45도 회전합니다.

speed `가 생성자 매개변수이므로 Creator Hub의 Script 컴포넌트에도 필드로 표시됩니다. Script 컴포넌트 오른쪽 위의 새로고침 아이콘을 클릭해 확인한 다음, 코드를 건드리지 않고 값을 조정해 보세요.` 새로고침 버튼

<img src="https://3980763956-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoPnXBby9S6MrsW83Y9qZ%2Fuploads%2Fgit-blob-8f1b521e1b68b5d9138dd1b60eeb40e4b13dbb0c%2Fscript-refresh-button.webp?alt=media" alt="각 엔티티에는" width="360">

필드의 값이 **Speed** 각각 저장됩니다. 따라서 여러 아이템이 같은 스크립트를 공유하면서도 서로 다르게 동작할 수 있습니다. 직접 해 보세요. Ctrl + C와 Ctrl + V로 아보카도를 복사하고 두 아보카도가 겹치지 않도록 복사본을 옮긴 뒤, 각각 다른 속도를 설정하세요. 이제 아보카도마다 회전 속도가 다릅니다.

스크립트는 다른 스마트 아이템이 실행할 수 있는 동작을 노출하는 등 훨씬 더 많은 일을 할 수 있습니다. 전체적인 내용은 [Script 컴포넌트](https://docs.decentraland.org/creator/content-creator-ko/scene-editor/extend-with-code/script-component.md) 에서 확인하세요.

## 씬 편집기에서 아이템 참조하기

Script 컴포넌트는 단일 아이템에 동작을 부여하는 가장 쉬운 방법이지만, 다른 방법도 있습니다. 다음 위치에 작성한 코드는 `index.ts` 이름을 사용해 시각적으로 추가한 항목을 가져올 수 있습니다. 다음을 사용하세요. `engine.getEntityOrNullByName()`. 여러 항목이 관련된 로직을 작성하거나 모든 내용을 한곳에 모으고 싶을 때 유용합니다. 엔티티 트리에 표시된 이름을 사용하세요. [엔티티 트리](https://docs.decentraland.org/creator/content-creator-ko/scene-editor/get-started/scene-editor-essentials.md#the-entity-tree).

이 예시에서는 이름이 다음과 같은 엔티티를 사용합니다. **노란색 상자**. 어떤 항목이든 사용할 수 있지만, 엔티티 트리에 표시된 이름을 정확히 입력하세요.

{% hint style="info" %}
**💡 팁**: 엔티티 트리에서 마우스 오른쪽 버튼을 클릭하고 **이름 바꾸기** 를 선택하면 엔티티의 이름을 바꿀 수 있습니다.
{% endhint %}

```ts
export function main() {
	// 이전에 작성한 avocado2 코드
	// (...)

	const crate = engine.getEntityOrNullByName('Yellow Crate')

	if (crate) {
		pointerEventsSystem.onPointerDown(
			{
				entity: crate,
				opts: { button: InputAction.IA_POINTER, hoverText: 'Open' },
			},
			function () {
				console.log('CLICKED CRATE')
			}
		)
	}
}
```

여기서 `engine.getEntityOrNullByName()` 이름이 다음과 같은 엔티티의 참조를 가져옵니다. *노란색 상자*. 다음 `if (crate)` 검사는 해당 엔티티가 씬에 실제로 있는지 확인합니다. 해당 이름의 엔티티가 없으면 `crate` 는 `null`입니다. 자세한 내용은 [항목 참조하기](https://docs.decentraland.org/creator/content-creator-ko/scene-editor/extend-with-code/reference-items.md) 를 참조하세요.

{% hint style="info" %}
**💡 팁**: 씬 편집기를 통해 추가한 엔티티는 모두 `main()` 이 실행될 때 이미 로드되어 있으므로, 해당 함수나 그 함수에서 간접적으로 호출되는 함수에서 엔티티를 참조해도 안전합니다. `main()`.
{% endhint %}

## 추가 튜토리얼

Decentraland 씬이 작동하는 방식을 개략적으로 이해하려면 [씬 코딩하기](https://docs.decentraland.org/creator/content-creator-ko/sdk7/getting-started/coding-scenes.md) 를 읽어보세요.

SDK7로 만든 예시는 재사용 가능한 씬과 저장소가 포함된 [예시 페이지](https://docs.decentraland.org/creator/content-creator-ko/tutorials-and-examples/examples.md)에서 확인할 수 있습니다.

씬에 콘텐츠를 추가하는 방법은 **개발 가이드** 섹션에서 자세히 알아보세요.

## 다른 개발자와 소통하기

다음에 방문하세요: [Decentraland 디스코드](https://dcl.gg/discord) 및 [Decentraland DAO Discord](https://discord.gg/bxHtcMxUs4) Decentraland Discord의 활발한 토론에 참여해 무엇이 가능한지, 어떻게 할 수 있는지 알아보려면 **크리에이터** 섹션을 확인하세요.

문제를 디버깅하려면 [문제 해결](https://docs.decentraland.org/creator/content-creator-ko/sdk7/debugging/troubleshooting.md) 및 [디버그](https://docs.decentraland.org/creator/content-creator-ko/sdk7/debugging/debug-in-preview.md) 섹션을 확인하세요. 또한 [SDK 스킬](https://docs.decentraland.org/creator/content-creator-ko/sdk7/getting-started/vibe-coding.md) 이 설치된 AI 어시스턴트도 훌륭한 디버깅 도우미입니다. 콘솔의 오류 메시지를 붙여 넣거나 예상과 다르게 작동하는 부분을 설명하면 대개 코드에서 문제를 찾아낼 수 있습니다. 해결 방법을 찾지 못했다면 Decentraland 포럼의 [SDK 지원 카테고리](https://forum.decentraland.org/c/support-sdk/11) 에 게시할 수 있습니다.

## 3D 아트 에셋

훌륭한 경험에는 그에 어울리는 뛰어난 3D 아트가 필요합니다. 직접 3D 모델을 만들고 싶다면 [3D 모델링 섹션](https://docs.decentraland.org/creator/content-creator-ko/3d/3d-models.md)을 확인하세요. 하지만 코딩이나 게임 디자인에 집중하고 싶다면 에셋을 직접 만들 필요는 없습니다! 씬에 사용할 3D 모델을 찾을 수 있는 에셋 라이브러리와 AI 도구는 [유용한 리소스](https://docs.decentraland.org/creator/content-creator-ko/sdk7/getting-started/useful-resources.md) 에서 확인하세요.

## 씬 게시

Decentraland NAME, ETH ENS 이름 또는 LAND를 소유하고 있거나, 소유자로부터 권한을 부여받았다면 Decentraland에 씬을 업로드할 수 있습니다. 자세한 내용은 [게시](https://docs.decentraland.org/creator/content-creator-ko/sdk7/publishing/publishing.md).

## 기타 유용한 정보

* [AI를 활용한 바이브 코딩](https://docs.decentraland.org/creator/content-creator-ko/sdk7/getting-started/vibe-coding.md)
* [개발 워크플로](https://docs.decentraland.org/creator/content-creator-ko/sdk7/getting-started/dev-workflow.md)
* [씬 편집](https://docs.decentraland.org/creator/content-creator-ko/scene-editor/get-started/about-editor.md)
* [씬 편집기 필수 사항](https://docs.decentraland.org/creator/content-creator-ko/scene-editor/get-started/scene-editor-essentials.md)
* [게임 설계 제약 조건](https://docs.decentraland.org/creator/content-creator-ko/sdk7/designing-the-experience/design-games.md)
* [3D 모델링](https://docs.decentraland.org/creator/content-creator-ko/3d/3d-models.md)
* [씬 제한 사항](https://docs.decentraland.org/creator/content-creator-ko/sdk7/optimizing/scene-limitations.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/sdk7/getting-started/sdk-101.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.
