Entities · function

definePrefab

A prefab, refused here if it names a field one of its components does not have.

Explained in Entities.

function definePrefab(name: string, components: readonly (readonly [ComponentType, Readonly<Record<string, unknown>>])[]): Prefab
import { definePrefab } from '@driftengine/entities';

Parameters

ParameterTypeDescription
namestring
componentsreadonly (readonly [ComponentType, Readonly<Record<string, unknown>>])[]

In depth

At definition rather than at the first spawn, which is the same refusal World.add makes, moved to where a game builds its content: a misspelt field found the first time a rare enemy spawns is found by a player.