Appearance
Function: prefab()
ts
function prefab<P>(build): Prefab<P>;Defines a prefab: export const Enemy = prefab((p: { at: Vec3 }) => [Transform({ ...p.at }), Health({ hp: 30 })]) then commands.spawn(Enemy, { at }).
Type Parameters
| Type Parameter | Default type |
|---|---|
P | void |
Parameters
| Parameter | Type |
|---|---|
build | (params) => ConfigurableTrait[] |
Returns
Prefab<P>