Build a shrine from kit pieces
Updated
A small shrine assembled from one modular kit file: floor tiles, pillars, walls, a beam and steps are each a Kit Piece that loads only the part named by its pieceId. The script counts the pieces as they load.
Orbit around the shrine: every part comes from the same kit file. The log counts the pieces as they load. Drag to orbit the camera, scroll to zoom.
Build a shrine from kit pieces
#pragma lifecycle(startup, update)
const pieces = new Map(); // pieceId → copies loadedlet total = 0;let statue;
function startup() { statue = findEntity('Amber Statue'); log('Loading the shrine from one kit file'); on('kit', ({ eventType, entityId, data }) => { if (eventType === EventType.KitPiece.Error) log('A piece failed:', data.message); if (eventType !== EventType.KitPiece.Ready) return; const id = findEntity(entityId).getComponent(KitPieceComponent).props.pieceId; pieces.set(id, (pieces.get(id) ?? 0) + 1); total += 1; if (total === 14) log('Shrine built from', [...pieces].map(([name, n]) => `${n} ${name}`).join(', ')); });}
function update(dt, time) { statue.rotation.y = time * 0.6; statue.position.y = 0.7 + Math.sin(time * 1.5) * 0.1;}Open it in XR Creator
Section titled “Open it in XR Creator”Download the project file below, then import it in XR Hub with Projects › New › Import, as described in Projects and templates. It opens in XR Creator with the same scene you see running above, each script already attached to its Behavior entity. From there you can edit the scripts, adjust components and their props, preview your changes, and deploy the result as a world of your own.
KitTemple.xrproj