add-interactivity
Installation
SKILL.md
Adding Interactivity to Decentraland Scenes
Authoring split
The clickable entity (cube, button, model) is static — declare it in main-entities.ts with its Transform / Mesh / Material. The clickability itself is always added at runtime in src/index.ts via pointerEventsSystem.onPointerDown(...) (or the related helpers). The helper writes the PointerEvents component AND registers the callback in a single call — do NOT also declare PointerEvents in main-entities.ts; the helper would just overwrite it and the duplication invites drift.
// main-entities.ts — entity only, no PointerEvents
clickable_cube: {
components: {
Transform: { position: { x: 8, y: 1, z: 8 } },
MeshRenderer: { mesh: { $case: 'box', box: { uvs: [] } } }
}
}
// src/index.ts — register clickability via the helper system
import { engine, pointerEventsSystem, InputAction } from '@dcl/sdk/ecs'