Scripting API
Scripting API
AbyssComponentAttribute
Class in Abyss.Core, from Abyss.Core.
Marks a plain-data struct as a component the engine should be able to describe.
public sealed class AbyssComponentAttribute : AttributeRemarks
A component registered without a field table is a size and an alignment. The engine stores it, hands it back and lets it be written whole — but it has no names to show and no offsets to edit at, so an inspector can only report "eight bytes, which the engine cannot describe". This attribute is what closes that gap for a component a game declared, rather than one the engine did.
The generator does not write the offsets down. It emits code that computes each one from the address of the field inside a real value of the struct, so the table is whatever the CLR actually chose for this build. That is the same rule the engine applies to itself — every offset on the Rust side comes from offset_of! or from reflection — and it exists because a layout somebody typed out is a layout that goes quietly wrong the day the struct changes.
The struct must be partial, because the generator adds members to it. Fields whose type the engine cannot describe are skipped with a warning rather than failing the build: a component that is half-inspectable is more useful than one that will not compile.
[AbyssComponent][StructLayout(LayoutKind.Sequential)]public partial struct Spin{ public float Speed; public float Phase;}
ComponentType<Spin> spin = Spin.Register(world);Properties
Name
public string? Name { get; set; }The name the engine knows the component by; defaults to the type name.
It is what an inspector shows and what a saved scene would name, so it is worth setting when the CLR type name is an implementation detail.
Page
public string? Page { get; set; }The page that documents the component, which the ? on its header in the editor's Inspector opens, as F1 does with the pointer over it: a whole address, https://example.com/docs/spin, or a page of the Abyss Manual by its path there, manual/concepts/ecs, opened at the editor's own version.
Without one, a component of the engine's or of an official package has its page in the Scripting API, and any other has no ?.
