2026-05-12

Godot Integration Guide

ULinkRPC.Starter can generate Godot 4.x C# clients. The Godot path shares the same Shared contracts, server project, and Roslyn Source Generator flow as the Unity path.

Create a Godot Project

Start with WebSocket + JSON:

dotnet tool install -g ULinkRPC.Starter
ulinkrpc-starter new --name MyGame --client-engine godot --transport websocket --serializer json
cd MyGame
dotnet run --project Server/Server/Server.csproj

The client is located at:

MyGame/Client

Open that directory with Godot 4.x, wait for Godot to generate and restore the C# solution, open Main.tscn, and click Play.

Generated Godot Structure

The starter generates:

Client/
  project.godot
  Client.csproj
  Main.tscn
  Scripts/
    Rpc/
      Testing/
        RpcConnectionTester.cs

Client.csproj references ../Shared/Shared.csproj and adds NuGet packages for the selected transport and serializer. Godot client RPC glue is generated by ULinkRPC.Analyzers at compile time.

Godot SDK and NuGet

The starter tries to find the local Godot Mono SDK package Godot.NET.Sdk.*.nupkg. If found, it generates a NuGet.config pointing to the local Godot package source and nuget.org.

If restore fails, check that:

  • You installed the Godot .NET / Mono build, not the GDScript-only build.
  • The Godot.NET.Sdk version in Client.csproj matches the local Godot version.
  • The local Godot GodotSharp/Tools/nupkgs path can be used as a NuGet source.

Daily Development Flow

Contracts are still changed only under Shared/Interfaces/. After changing RPC interfaces or DTOs, build the Godot C# project normally to run the source generator:

dotnet build Client/Client.csproj

Godot-side communication glue is generated by the compiler. Server implementations live under Server/Server/Services/, and Godot business scripts should live in your own directories under Client/Scripts/.

Transport and Serializer

The Godot starter currently supports tcp, websocket, kcp, plus json and memorypack. For a first integration, use websocket + json. After connection, source generation, and server implementation are stable, evaluate MemoryPack or another transport.

In MemoryPack mode, Shared DTOs include MemoryPack annotations and the starter writes the related dependencies into the project. DTO versioning needs more care; see DTO Versioning.

Threading and Lifetime

The default RpcConnectionTester connects from _Ready() and triggers shutdown from _ExitTree(). Real projects should add a connection state machine and prevent multiple buttons from creating duplicate connections.

ULinkRPC background callbacks are not guaranteed to run on the Godot main thread. When updating Node, SceneTree, or UI objects, hand results off to main-thread logic.

Current Limits

The Godot guide is currently based on the starter generation path and repository samples. The repository does not provide a Godot-specific main-thread dispatcher, editor plugin, automatic reconnect framework, or validation report for the Godot export platform matrix.