Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

definePrefab

definePrefab<Options>(name, options?): Prefab<Options>

Declares one kind of entity under name, at module scope in a module the room and every page import: <Entity prefab={wolf} /> places one in a scene, and spawn(step, wolf, { position }) makes more from a system. Throws for a name another prefab holds, and for a trait record holding a value a spawn cannot copy, naming the trait and the field.

Type Parameter Default type
Options extends PrefabOptions object
Parameter Type
name string
options Options

Prefab<Options>