FishNet / UniTaskIL weavingPublic source

Async FishNet RPC

Tools & Networking Programmer · Networking extension · 2024

I added completion hooks to FishNet’s generated RPC code so callers can await server work with UniTask.

Why I built it

Sometimes client code needs to wait for server work before continuing. I wanted to write that as an awaitable call and let an RPC manager track completion.

Call site

await AsyncRPCCallManager
    .Instance.ExecuteRPC(AsyncRPC);

Usage from the repository README; AsyncRPC must use the documented attribute and method signature.

My contribution

  • Code generation: Used Mono.Cecil to add completion hooks to FishNet’s generated RPC code.
  • Request tracking: Paired request IDs with UniTask completion sources so each call waits for its matching response.

Using the extension

The extension requires FishNet, UniTask, Mono.Cecil, and an AsyncRPCCallManager component in the scene. See the README for the required RPC signature. It hooks into generated code, so check compatibility with the FishNet version your project uses.

This builds on FirstGearGames’ FishNet code generation. I added the completion hooks and call tracking; the repository keeps the original credits.

Related multiplayer work

For a game project using server-authoritative Unity networking, see Metin2 Remastered.