Scripting API

Scripting API

AddressableSettings

Class in Abyss.Core, from Abyss.Core.

A game's groups of addressable assets, each built into a pack of its own: settings/addressables.json.

public sealed class AddressableSettings

Remarks

What is in a group is said by the asset, in its sidecar or its folder's, as its address is (AssetAddress.Group), so moving the file keeps it in its group. This file holds the groups themselves, in the order Window ▸ Addressables lists them, so one with nothing in it yet is kept. AssetAddress.DefaultGroup is always there and is never listed: what is in it goes into the game's main pack, Pack.Main, with the build's scenes.

Each other group is a pack beside the main one, named after it — Level 2 is level2.abypack (PackNames) — which a built game mounts as it starts; or, for one of AddressableSettings.AddOns, a pack that does not ship with the game, built into a folder of its own for the game to attach later (AddOnList).

Properties

Groups

public List<string> Groups { get; }

The groups besides AssetAddress.DefaultGroup, in their order, each once.

AddOns

public HashSet<string> AddOns { get; }

The groups built into add-ons: packs that do not ship with the game, which it attaches once it has them — downloaded, put beside it by a store, or given — each among AddressableSettings.Groups.

Methods

FileIn

public static string FileIn(string game)

Where a game keeps them: settings/addressables.json in its folder.

Parameters

  • game: The game's folder, the one its assets are in.

Read

public static AddressableSettings Read(string game)

A game's groups, from its folder; none for a game with no file.

Parameters

  • game

Exceptions

  • FormatException: The file is not groups this build reads.
  • IOException: The file is there and cannot be read.

Parse

public static AddressableSettings Parse(string json)

Groups from their text.

Parameters

  • json

Exceptions

  • FormatException: It is not groups this build reads, saying why.

GroupsOf

public static IReadOnlyList<string> GroupsOf(string game, AssetDatabase database)

Every group of a game, in the order Window ▸ Addressables lists them: AssetAddress.DefaultGroup first, then those its file lists, then any a file or folder names that it does not, by name.

Parameters

  • game: The game's folder; empty for none, which lists only what the files name.
  • database: Its assets, whose sidecars say what group each is in.

Exceptions

  • FormatException: The game's file is not groups this build reads.

Add

public bool Add(string group)

Adds a group at the end, trimmed; nothing for one there already, the default, or nothing.

Parameters

  • group

Returns Whether it was added.

ToJson

public string ToJson()

The groups as the words the file holds.

Write

public void Write(string game)

Writes them into a game's folder, making its settings folder if it has none.

Parameters

  • game

Exceptions

  • IOException: The file could not be written.

PackNames

public static IReadOnlyDictionary<string, string> PackNames(IEnumerable<string> groups)

What pack each group is built into: AssetAddress.DefaultGroup the main pack, Pack.Main, and each other its name in lower case, its letters and digits alone — Level 2 is level2.abypack — numbered where two would be one, or one would be the main pack's.

Parameters

  • groups: The groups, the default among them or not, in their order.

Constants

FileName

public const string FileName = "addressables.json"

The file, under BuildSettings.FolderName.

PathName

public const string PathName = "settings/addressables.json"

What it is called in a game's folder: settings/addressables.json.

CurrentVersion

public const int CurrentVersion = 2

The version this build writes, and the newest it reads: 2 writes each group as an object, which says whether it is an add-on; 1 wrote names.