跳转到内容

diffAgainstSource

此内容尚不支持你的语言。

diffAgainstSource(source, instance, options?): object

Defined in: prefab/diff.ts:67

Compute the minimal PrefabOverride[] that, applied to source, produces the instance state. The editor calls this on every change to an instance to keep prefab:overrides accurate.

Contract: applyOverrides(flattenPrefab(source, [], ctx), diffAgainstSource(source, instance)) reproduces instance modulo runtime id remapping.

Current scope:

  • Handles property / component_added / component_replaced / component_removed / name / visibility / metadata_set / metadata_removed
  • Handles instance entities that are NEW relative to source (reports them via untracked — caller decides whether to surface as variant additions or error)
  • Does NOT yet emit “entity_removed” overrides (entity deletion from an instance has no override type today); missing entities are reported via orphanedSourceIds.

PrefabData

readonly ProcessedEntity[]

DiffOptions

object

orphanedSourceIds: string[]

overrides: PrefabOverride[]

untracked: ProcessedEntity[]