Class AssetLibrary¶
Namespace: Apogee.Host
Assembly: Apogee.Host.dll
Asset identity for scripts, as the global assets: an asset is named by its path (res://models/car.glb), which people read, and has a UID (uid://4k2m9x7q1w3ze), which stays the same when
the file is renamed or moved. A reference is the text path|uid://…; a path alone and a uid://… alone are also references. models.load and the other loaders take a path or a uid:// directly.
public sealed class AssetLibrary : EngineObject
Inheritance¶
object ← EngineObject ← AssetLibrary
Inherited Members¶
EngineObject.IsAdopted, EngineObject.Handle, EngineObject.IsDestroyed, EngineObject.Class, EngineObject.Adopt(), EngineObject.TryGet(SlotHandle, out EngineObject), EngineObject.Destroy(), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors¶
AssetLibrary(AssetDatabase)¶
public AssetLibrary(AssetDatabase assets)
Parameters¶
assets AssetDatabase
Which file has which UID, over the game's files.
Properties¶
Class¶
What the registry knows about this object's class.
public override ClassInfo Class { get; }
Property Value¶
Methods¶
RefOf(string)¶
The reference to the asset at path, path|uid://…, or just the path when it has no UID: what to store where a script keeps a model or a picture across runs.
public string RefOf(string path)
Parameters¶
path string
The path of the asset.
Returns¶
Resolve(string)¶
The file a path, a uid:// or a reference (path|uid://…) means, as a path: the path itself when that file exists, otherwise the file that has the UID, otherwise nil. A UID found
this way for a path that no longer leads anywhere means the file was moved.
public string? Resolve(string text)
Parameters¶
text string
A path, a uid:// or a reference.
Returns¶
UidOf(string)¶
The UID of the asset at path as uid://…, or nil when the file does not exist or has none (an asset gets its UID when the project is imported).
public string? UidOf(string path)
Parameters¶
path string
The path of the asset.