Vixen
dd8b0a81
csharp
public static class PrefabOverrides

Which of a prefab instance's members are its own, and what a scene does when the prefab has changed underneath it.

Read the guide page for this →

Remarks

Pure functions over the authoring format, and deliberately nothing else. No World, no SceneDocument, no project on disk — an override is a statement about a file, so deciding what it means needs only the file and the file it points at. That is also what makes every case in doc 47 § 5 testable without an editor.

⚠ Reconciliation is an editor-side pass and runs at open time only. Neither the content build nor the runtime can do it: an importer is given an AssetId and no way to resolve one to a path, so SceneCompiler could not open the prefab an instance names even if it wanted to. That constraint is the reason the file carries resolved values at all rather than the sparse patch everybody reaches for first — doc 47 § 2 and § 3.

A member path is Member or Alias.Member. A bare name is one of the entity's own four; a dotted one names a [DataContract] alias in Components and a member on it. Matching is case-insensitive so that a hand-edited file is forgiving; Mark writes the canonical spelling.

Fields and properties (1)

  • public static readonly string[] OwnMembers

    The entity's own members that an override may name.

Methods (11)

  • public static bool IsInstance(SceneEntityData entity)

    Whether an entity is a prefab instance at all.

  • public static bool IsOverridden(SceneEntityData entity, string path)

    Whether a member is the instance's own rather than the template's.

  • public static bool Mark(SceneEntityData entity, string path)

    Says that a member is the instance's own.

  • public static bool Clear(SceneEntityData entity, string path)

    Gives a member back to the template, which is what "revert" means.

  • public static bool TryRead(SceneEntityData entity, string path, out object? value)

    Reads a member of an entity by its path.

  • public static bool TryWrite(SceneEntityData entity, string path, object? value)

    Writes a member of an entity by its path.

  • public static int Apply(SceneEntityData instance, SceneEntityData template, ICollection<PrefabReport>? reports = null)

    Brings one instance entity back in step with the template entity it came from.

  • public static int Reconcile(SceneFile scene, string prefab, SceneFile template, ICollection<PrefabReport>? reports = null)

    Brings every instance of one prefab in a scene back in step with it.

  • public static int Reconcile(SceneFile scene, IReadOnlyDictionary<string, SceneFile> templates, ICollection<PrefabReport>? reports = null)

    Brings every prefab instance in a scene back in step with the templates it came from.

  • public static bool TryFindLink(SceneFile file, string prefab, EntityId source, out SceneEntityData entity)

    Finds one entity in a file by the prefab link it carries.

  • public static bool TryFind(SceneFile file, EntityId id, out SceneEntityData entity)

    Finds one entity in a file by the id the file gave it.

Used by (5)

  • PrefabOverrideTestsVixen.Editor.Core.Tests
  • PrefabPlacementTestsVixen.Editor.AssetEditors.Tests
  • PrefabReconcileVixen.Editor.Core
  • PrefabSerializationTestsVixen.Editor.SceneView.Tests
  • PrefabSourceVixen.Editor.AssetEditors