Scripting API

Scripting API

SharedText

Record struct in Abyss.Core, from Abyss.Core.

A text a component holds: a handle to a string the engine keeps, which never changes, so copies of it share it safely, as copies of a C# string do.

public readonly record struct SharedText

Remarks

A component is plain data, copied as bytes, so it cannot hold a string; it holds this instead. World.Text makes one, equal strings sharing a handle, and World.TextOf reads it. Setting a component's text is making another and putting it there; what was there is let go of once nothing holds it.

A text lives while a component or a list's item holds it, and through the frame it was made in. A handle kept anywhere else — a field of a class, a static, a resource — is not held, and reads as gone once its text is let go of: keep the string there, and make the text when it goes in a component. The build refuses a resource, an animation event, a project's settings, a data asset or a window's state holding one (ABYSS041). For a short text of a size known in advance, a FixedText64 field holds its bytes in the component itself.

Constructors

SharedText

public SharedText(ulong Handle)

A text a component holds: a handle to a string the engine keeps, which never changes, so copies of it share it safely, as copies of a C# string do.

Parameters

  • Handle: The engine's handle: zero for no text, which reads as empty.

A component is plain data, copied as bytes, so it cannot hold a string; it holds this instead. World.Text makes one, equal strings sharing a handle, and World.TextOf reads it. Setting a component's text is making another and putting it there; what was there is let go of once nothing holds it.

A text lives while a component or a list's item holds it, and through the frame it was made in. A handle kept anywhere else — a field of a class, a static, a resource — is not held, and reads as gone once its text is let go of: keep the string there, and make the text when it goes in a component. The build refuses a resource, an animation event, a project's settings, a data asset or a window's state holding one (ABYSS041). For a short text of a size known in advance, a FixedText64 field holds its bytes in the component itself.

Properties

Handle

public ulong Handle { get; init; }

The engine's handle: zero for no text, which reads as empty.

Empty

public static SharedText Empty { get; }

No text: what a new component holds where nothing gives it one, and reads as empty.

IsEmpty

public bool IsEmpty { get; }

Whether it holds no text.