Entities · function

serializeWorld

Write a world out.

Explained in Entities.

function serializeWorld(world: World, types: readonly ComponentType[]): SerializedScene
import { serializeWorld } from '@driftengine/entities';

Parameters

ParameterTypeDescription
worldWorld
typesreadonly ComponentType[]

In depth

The component types are passed rather than discovered, because a world holds a store for every type anything has ever asked it about — including empty ones a query created — and a scene is a decision about what to save rather than everything that happens to exist.