public sealed class RpcGeneratorWrites the sender, the dispatch table and the manifest entry for every [ServerRpc] and [ClientRpc] handler.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
This is the piece the reference implementation gets by rewriting IL: there, one method name means both "send this" and "run this", depending on where it is called. ADR-002 bans the weaving and NativeAOT would not survive it, so the handler keeps its name and the sender gets its own — reached through a nested Rpc accessor, so the call site reads Rpc.TakeDamage(dmg) and says out loud that a packet is being sent.
That is one line more ceremony and materially better code. Transparent RPC hides latency and bandwidth at the call site, which is a well-known readability trap; the constraint pushed the design somewhere better.
The table is ordered by hashed method id at build time and the wire carries the position, so adding a method cannot silently reroute an old one on a peer that has not been rebuilt: the ordering changes, the manifest hash changes, and the handshake refuses the connection.
Fields and properties (5)
public const string ServerRpcAttributeThe attribute marking a handler a client calls and a server runs.
public const string ClientRpcAttributeThe attribute marking a handler a server calls and clients run.
public const string RpcObjectInterfaceThe interface a type declaring calls has to implement.
public const string RpcContextTypeThe type a handler takes as its first parameter to be told who called it.
public const string DescribeStepThe name of the step that turns the handlers into source.
Methods (1)
public void Initialize(IncrementalGeneratorInitializationContext context)Called to initialize the generator and register generation steps via callbacks on the
Used by (1)
- GeneratorHarnessVixen.Net.Generators.Tests