SpawnBatch
Defined in: SpawnBatch.ts:16
The operations available inside a Scene.spawnBatch callback.
Reserve every entity first, link the hierarchy, then run setup. Because all
of them exist before any setup() runs, a setup parameter can hold a handle
to an entity that has not been set up yet.
Methods
Section titled “Methods”addChild()
Section titled “addChild()”addChild(
parent,name,child):void
Defined in: SpawnBatch.ts:34
Link two reserved entities, so the child’s setup() can read its parent
and siblings. Both must come from this batch’s reserve().
Parameters
Section titled “Parameters”parent
Section titled “parent”string
Returns
Section titled “Returns”void
reserve()
Section titled “reserve()”reserve<
E>(Class,options?):E
Defined in: SpawnBatch.ts:28
Construct an entity and register its key without running setup(). The
entity belongs to the scene from this point — entity.scene,
entity.handle(), and entity.requireKey() all work — but it stays out
of scene.getEntities(), findByKey(), and every query until the batch
commits.
options.active sets the state the entity wakes up in. The default,
true, activates it when the batch commits; false commits it dormant,
to be woken later with setActive(true).
Type Parameters
Section titled “Type Parameters”E extends Entity
Parameters
Section titled “Parameters”() => E
options?
Section titled “options?”Returns
Section titled “Returns”E
setup()
Section titled “setup()”setup<
E>(entity, …rest):void
Defined in: SpawnBatch.ts:40
Run a reserved entity’s setup(). Trailing arguments follow its setup
signature, the way scene.spawn(Class, params) does.
Type Parameters
Section titled “Type Parameters”E extends Entity
Parameters
Section titled “Parameters”entity
Section titled “entity”E
…SetupArgs<E>
Returns
Section titled “Returns”void