Scripting API

Scripting API

AssetGuid

Struct in Abyss.Core, from Abyss.Core.

A file's identity, which outlives where the file happens to sit.

public readonly struct AssetGuid

Remarks

Not a MeshId, a MaterialId or an ImageId, and the distinction is the whole point. Those are indices into lists one world built while it was running: dense, fast, and meaningless in any other process. This is the opposite — it means nothing at runtime and everything in a file, because it is what a scene can write down about a model and still find tomorrow after somebody has moved it into a different folder.

Held as two halves, eight bytes each, the bytes .NET writes a Guid in, read little-endian: what a field naming an asset is to the engine, one field of two whole numbers, there being no number of sixteen bytes. So a struct holding one, a PrefabRef or a LocalizedString, is laid out as those numbers, aligned as they are, and nothing writes the halves out by hand. The bytes are the ones a Guid lies in too.

Constructors

AssetGuid

public AssetGuid(Guid value)

The identity value is, minted once and never changed.

Parameters

  • value

Properties

None

public static AssetGuid None { get; }

The identity that names nothing.

Value

public Guid Value { get; }

The identity, as a Guid.

Known

public bool Known { get; }

Whether this names anything.

Low

public ulong Low { get; }

Its first eight bytes, as a field that names an asset holds them.

High

public ulong High { get; }

Its last eight bytes, as a field that names an asset holds them.

Methods

FromHalves

public static AssetGuid FromHalves(ulong low, ulong high)

The identity of the two halves a field holds.

Parameters

  • low
  • high

Equals

public bool Equals(AssetGuid other)

Parameters

  • other

Equals

public override bool Equals(object? obj)

Parameters

  • obj

GetHashCode

public override int GetHashCode()

ToString

public override string ToString()

The form a file carries: thirty-two hex digits, no braces and no dashes.

Chosen to be the shortest thing that is still unambiguous, and to look like an identity rather than like a sentence — a scene file is read by people as well as by programs, and a line of dashes in the middle of every asset is noise.

Parse

public static AssetGuid Parse(string? text)

Reads one back, or AssetGuid.None if the text is not one.

Parameters

  • text: The text to read.

Operators

operator ==

public static bool operator ==(AssetGuid left, AssetGuid right)

Two names of one identity.

Parameters

  • left
  • right

operator !=

public static bool operator !=(AssetGuid left, AssetGuid right)

Two names of different identities.

Parameters

  • left
  • right