Repository navigation
Code Generators
Sieluna edited this page Jul 22, 2026
·
2 revisions
Sia.CodeGenerators is an analyzer project that removes repetitive component code. Reference it with OutputItemType="Analyzer" and ReferenceOutputAssembly="false".
| Attribute | Generates |
|---|---|
[Sia] |
A SetXxx command/event and a writable component View property. |
[SiaBundle] |
IStaticBundle conversion for a fixed component group. |
[SiaEvents] |
An IEventUnion from nested event types. |
[SiaTemplate] |
A component, constructor, reset command, property commands, and view from a template type. |
[SiaSystem] |
An assembly system-descriptor provider. |
[ReactiveComponent] |
A cached reactive component Definition; see Reactive. |
public partial record struct Health([Sia] float Value);
var health = new Health.View(entity, world);
health.Value = 80;The view assignment updates storage and sends Health.SetValue. A direct ref write remains silent.
- Types containing
[Sia]members and reproduced containing types must bepartial. -
[SiaBundle],[SiaEvents], and[ReactiveComponent]targets must bepartial. -
[SiaTemplate]and[SiaSystem]targets need not bepartial. - Bundle members need unique component types.
-
[SiaEvents]needs at least one public concrete nestedIEvent. -
[SiaSystem]targets must be classes implementingISystem. -
[ReactiveComponent]requires a static partial class, readonly record-struct props/state, a record message type, and validInitialState,Reduce, andRenderextension members. - Place
[Sia],[SiaBundle],[SiaEvents], and[SiaTemplate]targets in a named namespace. - Avoid expression-bodied or
init-only[Sia]properties, indexers, duplicate names, generic nested events, and nesting deeper than one containing type.
Use non-empty mutable templates. Immutable or empty templates currently omit a required static contract member.
Never edit .g.cs output. If generation fails, inspect the emitted file and fix the annotated source.