用途:为 Decentraland SDK7 场景提供跨领域运行时 API,处理异步、网络、环境信息与玩家交互等操作。
主要能力:executeTask() 包裹异步逻辑(运行时单线程,裸 Promise 会被丢弃);fetch 请求公开 API,signedFetch 与 getHeaders 用于向自有后端证明玩家身份;WebSocket 连接;getSceneInformation、getRealm、getExplorerInformation 获取场景 URN、metadata、realm 名称与预览状态、Explorer 平台信息;getWorldTime 获取世界时间;readFile 读取随场景部署的文件;EngineInfo 组件读取帧级计时;RestrictedActions 提供 movePlayerTo、teleportTo、triggerEmote、openExternalUrl、openNftDialog、copyToClipboard、changeRealm 等需玩家交互后才能执行的操作;计时器建议用 @dcl/sdk/ecs 的 timers 而非全局 setTimeout/setInterval;Component.onChange() 监听组件变化;removeEntityWithChildren 递归删除实体;PortableExperiences 提供 spawn、kill、exit、getPortableExperiencesLoaded;内置测试框架,用 npx @dcl/sdk-commands test 运行。
用法与限制:外部 HTTP 需权限,signedFetch 要求玩家已与场景交互;受限操作同样需玩家交互;检测预览模式可用 realm.realmInfo?.isPreview。资料未提供收费、价格信息。