ULinkRPC.CodeGen
0.13.1
dotnet tool install --global ULinkRPC.CodeGen --version 0.13.1
dotnet new tool-manifest
dotnet tool install --local ULinkRPC.CodeGen --version 0.13.1
#tool dotnet:?package=ULinkRPC.CodeGen&version=0.13.1
nuke :add-package ULinkRPC.CodeGen --version 0.13.1
ULinkRPC.CodeGen
Command-line code generator for ULinkRPC.
Install (dotnet tool)
dotnet tool install -g ULinkRPC.CodeGen
Usage
ulinkrpc-codegen [options]
Modes
unity: generate Unity client + binder code.server: generate server binders +AllServicesBinder.
Generated client stubs now depend on ULinkRPC.Core.IRpcClient.
Generated client calls use typed descriptors (RpcMethod<TArg, TResult> / RpcPushMethod<TArg>) instead of passing raw service/method ids.
Generated Unity client output also includes IRpcClient extension factories (for example client.CreatePlayerService()) so business code does not instantiate generated client types directly.
Generated Unity client output also emits a complete ULinkRPC.Client.RpcClient wrapper that owns RpcClientRuntime, binds callbacks, and exposes the grouped Api facade.
Unity generated code namespace is derived from Unity output directory (for example Assets/Scripts/Rpc/RpcGenerated → Rpc.Generated).
Generated files now inherit using directives declared by contract sources so referenced types resolve correctly.
Contract parsing is implemented via Roslyn syntax trees for better correctness across C# language forms.
Generated binders reference ULinkRPC.Core + ULinkRPC.Server and include both Bind(RpcServiceRegistry, IYourService) and delegate-based Bind(...) overloads. Generated AllServicesBinder includes a convenience overload BindAll(RpcServiceRegistry registry) that reflects over the current assembly to locate concrete service implementations automatically; callback services prefer a single-parameter constructor accepting the callback interface, and fall back to a public parameterless constructor. Per-connection service creation now uses RpcSession.
Typical Unity-side usage now looks like this:
var options = new RpcClientOptions(
new TcpTransport("127.0.0.1", 20000),
new MemoryPackRpcSerializer());
var callbacks = new RpcClient.RpcCallbackBindings();
callbacks.Add(new PlayerCallbacks());
await using var client = new RpcClient(options, callbacks);
await client.ConnectAsync(ct);
var player = client.Api.Game.Player;
Options
--contracts <path>Path to contract sources (required).--mode <unity|server>Generation mode. If omitted, the tool will try to infer it from the current directory.--output <path>Output directory for generated files.--namespace <ns>Namespace for generated Unity code.--server-output <path>Output directory for server binders.--server-namespace <ns>Namespace for server binders.
Default Behavior
- Unity mode defaults output to
Assets/Scripts/Rpc/RpcGeneratedunder detected Unity project root. - If Unity project root cannot be detected, pass
--outputexplicitly. - Unity namespace defaults to value derived from output path unless
--namespaceis provided. - Server mode defaults output to
Generatedunder the detected server project root. If no server project root can be detected, it falls back to./Generated. - Server namespace defaults to
<contracts namespace>.Server.Generatedunless--server-namespaceis provided. - If
--modeis omitted, the tool auto-detectsunitywhen the current directory is inside a Unity project, andserverwhen the current directory is inside a directory tree that contains a.csprojserver project.
Paths can be overridden via options.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.13.1 | 0 | 3/14/2026 |
| 0.13.0 | 42 | 3/13/2026 |
| 0.12.5 | 34 | 3/12/2026 |
| 0.12.4 | 33 | 3/12/2026 |
| 0.12.3 | 63 | 3/11/2026 |
| 0.12.2 | 62 | 3/11/2026 |
| 0.12.1 | 68 | 3/11/2026 |
| 0.12.0 | 74 | 3/10/2026 |
| 0.11.0 | 73 | 3/10/2026 |
| 0.10.0 | 73 | 3/10/2026 |
| 0.9.1 | 77 | 3/9/2026 |
| 0.9.0 | 73 | 3/9/2026 |
| 0.8.2 | 70 | 3/9/2026 |
| 0.8.1 | 75 | 3/9/2026 |