Kit Piece
Updated
Places one piece chosen from a modular building kit.
- Type
comp-kit-piece- Script class
KitPieceComponent- Per entity
- One
- Version
- 1.0.0
Read about it in Models and meshes: what it does, how to use it from a script, and examples.
Events
Section titled “Events”Sent to the entity’s Signal Emitter as { entityId, eventType, data }. Compare eventType with the EventType constants.
KitPiece::readyKitPiece::error
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Build a shrine from kit piecesA 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.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(KitPieceComponent); if (component) log(component.props);}