Scripting API

Scripting API

AssetCatalog

Class in Abyss.Core, from Abyss.Core.

What a pack says of the assets it holds beside their bytes: each one's path and identity, and the address and labels of each addressable one.

public sealed class AssetCatalog

Remarks

What a built game finds an asset by, with no folders and no sidecars to read: an address a game names, a label it asks for, or the identity a component's PrefabRef holds. The editor finds the same things in its AssetDatabase, which this is written from.

Words, as the build's settings are: abyssCatalog says which version, and each asset is an object of its path, its identity and, when it is addressable, its address and its labels.

Properties

Empty

public static AssetCatalog Empty { get; }

A catalog listing nothing: what a pack written before catalogs has.

Entries

public IReadOnlyList<CatalogEntry> Entries { get; }

Every asset it lists, in order of their paths.

Methods

Of

public static AssetCatalog Of(AssetDatabase database, IEnumerable<string> paths)

The catalog of the files at paths, as database knows them.

Parameters

  • database: The project's files: each one's identity, address and labels.
  • paths: The files to list: what a pack holds.

Holding

public AssetCatalog Holding(IReadOnlySet<string> paths)

The same catalog listing only the assets at paths: what a pack was given of what it was to hold.

Parameters

  • paths

PathOf

public string? PathOf(AssetGuid id)

Where the asset of an identity is, or null for one the catalog does not list.

Parameters

  • id

Addressed

public string? Addressed(string address)

The asset an address names, the first by path where two have one; null for none.

Parameters

  • address: The address, matched exactly.

Labeled

public IReadOnlyList<string> Labeled(string label)

The addressable assets with a label, by path, in order of their paths.

Parameters

  • label: The label, matched exactly.

ToJson

public string ToJson()

The catalog as the words a pack keeps it in.

Parse

public static AssetCatalog Parse(string json)

A catalog from its words.

Parameters

  • json

Exceptions

  • FormatException: The words are not a catalog this build reads.

Read

public static AssetCatalog Read(Pack pack)

A catalog out of a pack, or AssetCatalog.Empty for a pack that holds none.

Parameters

  • pack

Exceptions

  • FormatException: The pack's catalog is not one this build reads.

Constants

PathName

public const string PathName = "catalog"

What a pack calls its catalog; no asset is called so, as every asset has an extension.

Version

public const int Version = 1

The version of the catalog's words, so a later one can be refused rather than misread.