Vixen
02b45cc4
csharp
public sealed class PrefabInstances

Which of a scene's entities came from a prefab, and from where in it.

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.

⚠ Not yet written to the .vxscene. A link recorded here survives an editing session and does not survive closing the project, so an instance placed today is an ordinary subtree tomorrow. Persisting it needs a field on SceneEntityData and a decision about what a scene does when the prefab it names has changed underneath it — doc 08's R7, and the next thing the scene format has to grow. What is here is the half that does not need the format to move.

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 (4)

  • public void Record(Entity entity, PrefabLink link)

    Records where an entity came from.

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

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

  • 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.

Used by (2)

  • PrefabVixen.Editor.AssetEditors
  • PrefabInstanceTestsVixen.Editor.AssetEditors.Tests