Vixen
dd8b0a81
csharp
public sealed class PrefabInstances

Which of a scene's entities came from a prefab, from where in it, and which of their members the instance claims as its own.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Beside the document rather than in the world. A link is editor bookkeeping: the runtime has no notion of a prefab — a compiled scene is entities and components, with the prefab flattened into it — so a component holding this would be thirty bytes an entity in every shipping build to serve a panel that does not exist at run time. That is the same argument SceneDocument makes about names.

⚠ In this assembly rather than beside the prefab document, because the writer is here. SceneSerializer is what turns a document into a SceneEntityData, so a table it cannot see is a link that cannot be written down — which is exactly the state doc 47 § 7 recorded as owed. A document owns one of these (Prefabs), and it travels with the names through PruneNames, Remap and a delete's snapshot for the reason every other table keyed by a handle does.

⚠⚠ The overrides are a list of names and never a comparison. Doc 47 § 4: if being overridden meant "differs from the template", an author who turned a lamp's intensity down to 0 would have said something nothing can represent, and the next reconcile would restore the template's brightness. Presence in the list is the override.

Fields and properties (2)

  • public int Count

    How many entities are linked.

  • public IReadOnlyDictionary<Entity, PrefabLink> Links

    Every link, by the entity that carries it.

Methods (14)

  • public void Record(Entity entity, PrefabLink link)

    Records where an entity came from.

  • public void Record(Entity entity, PrefabLink link, IEnumerable<string> claimed)

    Records where an entity came from and what it claims, in the order given.

  • public bool TryGet(Entity entity, out PrefabLink link)

    Where an entity came from, if it came from anywhere.

  • public IReadOnlyList<string> OverridesOf(Entity entity)

    Which members an entity claims as its own rather than the template's.

  • public bool IsOverridden(Entity entity, string path)

    Whether an entity claims a member as its own.

  • public bool Mark(Entity entity, string path)

    Says that a member of an entity is the instance's own.

  • public bool Clear(Entity entity, string path)

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

  • public IReadOnlyList<EntityId> RemovedFrom(Entity entity)

    Which of the template's entities this instance's author deleted.

  • public bool Remove(Entity root, EntityId source)

    Says that the author deleted one of the template's entities from this instance.

  • public bool Restore(Entity root, EntityId source)

    Takes back a removal, which is what undoing the delete means.

  • public void RecordRemoved(Entity root, IEnumerable<EntityId> gone)

    Records a whole removed list as a file gave it.

  • public bool Forget(Entity entity)

    Forgets an entity's link, which is what "unpack prefab" means.

  • public int Prune(World world)

    Forgets links whose entity is no longer alive.

  • public void Remap(IReadOnlyDictionary<Entity, Entity> translation)

    Moves the links across a play-mode restore's translation table.

Used by (13)

  • DestroyEntitiesCommandVixen.Editor.SceneView
  • DropIntoSceneTestsVixen.Editor.App.Tests
  • EntityGizmoTargetVixen.Editor.SceneView
  • PrefabVixen.Editor.AssetEditors
  • PrefabInspectorTestsVixen.Editor.AssetEditors.Tests
  • PrefabInstanceTestsVixen.Editor.AssetEditors.Tests
  • PrefabOverridePanelTestsVixen.Editor.App.Tests
  • PrefabPlacementTestsVixen.Editor.AssetEditors.Tests
  • PrefabSerializationTestsVixen.Editor.SceneView.Tests
  • PrefabSourceVixen.Editor.AssetEditors
  • SceneDocumentVixen.Editor.SceneView
  • SceneSerializerVixen.Editor.SceneView
  • SubtreeSnapshotVixen.Editor.SceneView