Scripting API

Scripting API

ComponentFieldSpec

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

One field of a component C# declares, on its way to the engine.

public readonly record struct ComponentFieldSpec

Remarks

The mirror image of ComponentField: that one carries what the engine said about a component it owns, this one carries what C# says about a component it owns. There is no ComponentId on it because it is handed over at registration, before the component has one.

Do not write an offset here by hand. The generator behind AbyssComponentAttribute computes each one from the address of the field inside a real value, which is exact for whatever the CLR chose. A number typed into source is a number that stops being true the day a field is added above it, and nothing would say so — the engine cannot check where a field is, only that it fits.

Constructors

ComponentFieldSpec

public ComponentFieldSpec(string Name, int Offset, FieldKind Kind, int Count)

One field of a component C# declares, on its way to the engine.

Parameters

  • Name: The field's name, as an inspector should show it.
  • Offset: Byte offset from the start of the component.
  • Kind: What kind of value it holds.
  • Count: How many: 1 for a scalar, N for an array.

The mirror image of ComponentField: that one carries what the engine said about a component it owns, this one carries what C# says about a component it owns. There is no ComponentId on it because it is handed over at registration, before the component has one.

Do not write an offset here by hand. The generator behind AbyssComponentAttribute computes each one from the address of the field inside a real value, which is exact for whatever the CLR chose. A number typed into source is a number that stops being true the day a field is added above it, and nothing would say so — the engine cannot check where a field is, only that it fits.

Properties

Name

public string Name { get; init; }

The field's name, as an inspector should show it.

Offset

public int Offset { get; init; }

Byte offset from the start of the component.

Kind

public FieldKind Kind { get; init; }

What kind of value it holds.

Count

public int Count { get; init; }

How many: 1 for a scalar, N for an array.

Size

public int Size { get; }

Total size of the field in bytes.