public sealed class ReplicationGeneratorWrites the replicator for every [Replicated] component, and the registration that hands them to the runtime.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
This is the code a careful person would have written and would then have to keep in step with the struct — the reason it is generated is that nobody does. A field added to a component and forgotten in its serializer is a desync that reproduces on one machine in ten; here the two cannot disagree, because there is only one declaration.
It also has to be generated rather than reflected. iOS is NativeAOT, so there is no run-time code generation to fall back on and reflection over a struct's fields is exactly what trimming removes. Everything about a component's layout is decided at build time and becomes ordinary C# that the AOT compiler can see through.
⚠ A generator is judged by what it does not re-run. The per-type step produces a String of finished source, so the cache compares text: editing an unrelated file re-runs nothing, and editing a component re-emits that component alone. Only the registration file depends on the set of them, and only the set — adding a field to a component does not invalidate it.
Fields and properties (4)
public const string ReplicatedAttributeThe attribute that says a component is replicated.
public const string QuantizeAttributeThe attribute that declares what a float is a float of.
public const string GeneratedNamespaceThe namespace the generated replicators live in.
public const string DescribeStepThe name of the step that turns one component declaration into source.
Methods (2)
public void Initialize(IncrementalGeneratorInitializationContext context)Called to initialize the generator and register generation steps via callbacks on the
public static uint HashTypeName(string fullName)The wire id of a type name: 32-bit FNV-1a, the same function ReplicationRegistry.HashTypeName computes at run time.
Used by (3)
- GeneratorHarnessVixen.Net.Generators.Tests
- ReplicationGeneratorTestsVixen.Net.Generators.Tests
- RpcGeneratorVixen.Net.Generators