Scripting API
Scripting API
DataAssetFile
Class in Abyss.Core, from Abyss.Core.
A data asset as its file keeps it, name.asset: {"abyssAsset": 1, "type": "Abyss.Physics2D.PhysicsMaterial2D", "fields": {...}}, its fields as a settings file keeps them.
public static class DataAssetFileMethods
Is
public static bool Is(string path)Whether path is a data asset's file.
Parameters
path
TypeOf
public static string? TypeOf(string json)The kind of data asset a file says it is, by the struct's full name; null for text that does not say.
Parameters
json
Read
public static (byte[] Bytes, IReadOnlyList<string> Problems) Read(DataAssetType type, string json, string where, Func<string, AssetGuid>? idOf = null)The asset's bytes, made of its file: what one starts as, each field the file names written over it. A file of another kind, a version too new, or text that is no JSON is what one starts as, and why is said, as is a field that cannot be read.
Parameters
type: The kind, described.json: The file's text.where: What the file is called, for what is said.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(DataAssetType type, ReadOnlySpan<byte> bytes, Func<AssetGuid, string?>? pathOf = null)The file of an asset whose bytes are bytes: its kind, and every field in the order the struct has them.
Parameters
type: The kind, described.bytes: Its 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.
New
public static string New(DataAssetType type)A new asset of type's file: what one starts as.
Parameters
type
Constants
Extension
public const string Extension = ".asset"What a data asset's file is called: .asset.
CurrentVersion
public const int CurrentVersion = 1The version of the file this build writes, and the newest it reads.
