Scripting API

Scripting API

ProjectSettingsFile

Class in Abyss.Core, from Abyss.Core.

A project's settings as their file keeps them: {"abyssSettings": 1, "fields": {"Gravity": [0, -9.81]}}, every field by its dotted name, each a number, or a list of numbers for one of several, as a scene keeps a component's; a fixed text as its text, and a reference to an asset as {"guid": ..., "path": ...}.

public static class ProjectSettingsFile

Methods

Read

public static (byte[] Bytes, IReadOnlyList<string> Problems) Read(SettingsType type, string? json, Func<string, AssetGuid>? idOf = null)

The settings' bytes, made of their file: what they start as, each field the file names written over it. A field the struct does not have is passed over, one renamed found by its old name; a file that cannot be read is what they start as, and why is said.

Parameters

  • type: The settings, described.
  • json: The file's text, or null for none, which is what they start as.
  • idOf: What a path names, for a reference whose identity is not known; none where there is nothing to ask.

Write

public static string Write(SettingsType type, ReadOnlySpan<byte> bytes, Func<AssetGuid, string?>? pathOf = null)

The file of settings whose bytes are bytes: every field, in the order the struct has them.

Parameters

  • type: The settings, described.
  • bytes: Their bytes, as large as the struct.
  • pathOf: Where an asset a reference names is, written beside its identity; none where there is nothing to ask.

Constants

CurrentVersion

public const int CurrentVersion = 1

The version of the file this build writes, and the newest it reads.