Class PrefabLibrary¶
Namespace: Apogee.Ecs
Assembly: Apogee.Ecs.dll
The prefab files a session knows, as numbers: one handle per file (the same file asked for by its path, its uid:// or both is the same handle), and each file's document, read once.
A handle is what
public sealed class PrefabLibrary
Inheritance¶
Inherited Members¶
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors¶
PrefabLibrary(VirtualFileSystem, AssetDatabase?)¶
The prefab files a session knows, as numbers: one handle per file (the same file asked for by its path, its uid:// or both is the same handle), and each file's document, read once.
A handle is what
public PrefabLibrary(VirtualFileSystem files, AssetDatabase? assets)
Parameters¶
files VirtualFileSystem
Where prefab files are read from and written to.
assets AssetDatabase?
Finds the file a uid:// names (and a prefab that moved); null: only paths are understood.
Methods¶
Document(uint)¶
The document of the prefab, read once and kept: the root Prefab element. Null when the handle is not one of this library's or names no file.
public XmlNode? Document(uint handle)
Parameters¶
handle uint
Returns¶
Exceptions¶
The file exists but cannot be read as an XML document (text or cooked).
Load(string)¶
The handle of the prefab that pathOrRef names: a path (res://prefabs/lamp.aprefab), a uid://…, or path|uid://…. The same file always gives the same
handle. A reference that names no file gives a handle too (its
public uint Load(string pathOrRef)
Parameters¶
pathOrRef string
Returns¶
Exceptions¶
The text is not an asset reference.
Load(AssetRef)¶
The handle of the prefab that reference names, or 0 for the empty reference. See
public uint Load(AssetRef reference)
Parameters¶
reference AssetRef
Returns¶
PathOf(uint)¶
The path of the file a handle names, or null when there is none (the reference names no file that exists) or the handle is not one of this library's.
public string? PathOf(uint handle)
Parameters¶
handle uint
Returns¶
RefOf(uint)¶
The reference a handle names: the file's path and UID, or, when no file has been found for it, the reference it was asked for. Null for a handle this library did not give.
public AssetRef? RefOf(uint handle)
Parameters¶
handle uint
Returns¶
Changed¶
Raised after the file of a prefab was written by this library's world (see
public event Action<uint>? Changed