Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / index / serializeEntitySubtree

Function: serializeEntitySubtree() ​

ts
function serializeEntitySubtree(
   world, 
   rootId, 
   options?): SerializeEntitySubtreeResult;

Defined in: prefab/serializeEntitySubtree.ts:42

Serialize rootId + all descendants into a self-contained snapshot: entity ids renumbered 1..N in BFS parent-first order, all internal id references remapped, external references nulled + reported, root ParentId forced to null. The result is directly consumable by hydrateWorldFromSnapshotDetailed / instantiateSubtree.

Parameters ​

ParameterType
worldWorld
rootIdnumber
options?{ maxDepth?: number; }
options.maxDepth?number

Returns ​

SerializeEntitySubtreeResult