Skip to content

1681-engine / index / PrefabValue

Type Alias: PrefabValue<T, A> ​

ts
type PrefabValue<T, A> = T | ((ctx) => T);

Defined in: src/ecs/prefab.ts:15

A component's value in a prefab: plain data (copied afresh for every entity, so no two share an object), or a factory called once per entity, for what cannot be copied (a class instance, a sprite) or must differ (a random roll, a position from the spawn's args). null in a variant takes away a component its base has.

Type Parameters ​

Type ParameterDefault type
T-
Aunknown

Released under the MIT License.