buildVariant
buildVariant(
base,baseRef,name,delta):PrefabData
Defined in: prefab/sceneInstance.ts:475
Build a prefab VARIANT that inherits baseRef and bakes an instance delta as
the variant’s own authored state — the authoring inverse of instantiating a
variant, and the sibling of applyDeltaToSource (which bakes INTO the
base instead of layering a new variant on top). Property / component / name /
visibility overrides become the variant’s overrides; entities the instance
ADDED become variant entities (appended onto the base by
mergeVariantEntities, which links them into their parent’s children on
flatten). The variant’s rootEntityId mirrors the base — variants EXTEND their
base, they never relocate the root.
A variant cannot DELETE a base entity (merge only replaces / appends), so
delta.removed is not representable and is ignored here; a caller that must
surface dropped removals should inspect it first. Pure: neither base nor
delta is mutated.
Parameters
Section titled “Parameters”baseRef
Section titled “baseRef”string
string
readonly AddedEntity[]
overrides
Section titled “overrides”readonly PrefabOverride[]