Skip to content

@relu-interactives/spatial-ecs


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

Function: computeInstanceOverrides() ​

ts
function computeInstanceOverrides(
   baseSnapshot, 
   instanceSnapshot, 
   options?): string[];

Defined in: prefab/overrides.ts:416

Diff a live instance subtree against its prefab base (both as serialized subtree snapshots carrying PrefabNode identity) and return the encoded override list: every path where the instance deviates from the base.

Identity is nodeKey-scoped (buildNodeKeyMapsFromSnapshot), so nested instance regions diff correctly; for nested-free documents the keys degenerate to bare nodeIds (v1 behavior unchanged).

Policies: components missing on the instance produce no override (apply re-adds them); components/nodes only on the instance are local additions and produce no override — EXCEPT when emitAdditionMarkers is set (file-space callers), which records "<key>|+node|" for instance nodes absent from the base so pure-JSON patching never deletes host-authored nodes inside nested regions.

Parameters ​

ParameterType
baseSnapshotSubtreeSnapshot
instanceSnapshotSubtreeSnapshot
options?{ emitAdditionMarkers?: boolean; }
options.emitAdditionMarkers?boolean

Returns ​

string[]