AssetLibrary¶
Extends EngineObject.
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.
Methods¶
resolve¶
function resolve(self, text: string): 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.
uid_of¶
function uid_of(self, path: string): 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).
ref_of¶
function ref_of(self, path: string): 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.