Vixen
dd8b0a81
csharp
public static class PrefabReconcile

Bringing a scene back in step with the prefabs it was authored against.

Read the guide page for this →

Remarks

⚠ An editor-side pass at open time, and it can never be anything else. ImportContext gives an importer its own GUID, its own source path and a file provider over paths — and no way to turn an AssetId into one. So SceneCompiler cannot open the prefab an instance names, which is the constraint that picked the whole format: doc 47 § 2. The editor can — AssetDatabase is the one place that knows which GUID is at which path today — and this is the half of the wall that has a door in it.

Over the file, before it reaches a document. Reconciliation is a rewrite of SceneEntityData values, so doing it to the parsed file rather than to a world means it needs no World, no SceneDocument and no viewport — and the loader that runs afterwards is the same loader that runs when nothing was stale.

⚠ The file on disk is not rewritten and the document does not open dirty. What is repaired is what the editor holds; the bytes catch up on the next save the author makes. An editor that wrote to a level merely because somebody looked at it would put changes in a working tree that nobody asked for, and would do it to every level in a project after a prefab was touched.

⚠ One pass, outer over inner, and deliberately not a fixpoint — R7's single level of nesting. It is two steps: every template is first brought in step with the prefabs it holds instances of, and only then is the scene brought in step with the templates. Composing the template first is what makes the scene's step one lookup — the outer file already holds the inner prefab's current values under the outer author's overrides, which is exactly what an instance of the outer should show.

⚠⚠ An earlier note here said the passes could not interfere because every entity carries at most one link. That is true and it is not the question. A scene node inside an instance of A carrying B's link is reachable from both templates, and the two disagree — B's file has none of A's overrides over B. The disjointness was of the link sets and not of the entities, and reconciling B on its own is how a nested prefab loses every override its outer author made. That is why Reconcile takes every template at once.

⚠ The composition happens to the parsed template in memory, and no .vxprefab is written either. The same rule as the scene's: a prefab somebody merely has a level open against is not a prefab they asked to edit.

Methods (2)

Used by (4)

  • PrefabVixen.Editor.AssetEditors
  • PrefabPlacementTestsVixen.Editor.AssetEditors.Tests
  • PrefabSourceVixen.Editor.AssetEditors
  • SceneSerializerVixen.Editor.SceneView