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

spawn

spawn<Made, Options>(authority, prefab, options?): SpawnedEntity<Made, Options>

Spawns an entity of prefab, posed and with traits over the prefab’s as options say, on the world authority decides for: the room’s step in a system, or requireAuthority(world) outside one. A step on a page in a room, a predicted step there and a re-run are no authority, so a spawn from them fails to typecheck. A join hook’s step spawns too, and a refused join takes back what it spawned. With no prefab, the entity has the options’ traits, and a pose where they give one.

Type Parameter Default type
Made extends Prefab<PrefabOptions> -
Options extends SpawnOptions | undefined undefined
Parameter Type
authority JoinStep | Authority
prefab Made
options? Options

SpawnedEntity<Made, Options>

spawn(authority, options): Entity

Spawns an entity of prefab, posed and with traits over the prefab’s as options say, on the world authority decides for: the room’s step in a system, or requireAuthority(world) outside one. A step on a page in a room, a predicted step there and a re-run are no authority, so a spawn from them fails to typecheck. A join hook’s step spawns too, and a refused join takes back what it spawned. With no prefab, the entity has the options’ traits, and a pose where they give one.

Parameter Type
authority JoinStep | Authority
options SpawnOptions

Entity