Unity SDK
The official Unity SDK wraps everything in the Getting Started guide for you. It asks your backend for a ticket, opens the WebSocket, starts and cancels searches, answers ping checks, sends heartbeats, and reconnects when the connection drops. You write the game logic; the SDK speaks the protocol.
It is open source (Apache 2.0) and ships as readable C# source: github.com/Pairiquium/UnitySDK.
What it handles, and what it doesn't
| The SDK handles | You handle |
|---|---|
| A fresh ticket for every connection attempt, including reconnects | The backend endpoint that mints tickets with your API key |
begin_search, cancel_search, and heartbeat | Which game mode and region to search in |
Replying to PING with pong | Getting players to a game server once a match is found |
| Party messages, and heartbeats for every party member | Your friends list or lobby UI, and sharing join codes |
| Reconnecting with backoff and resuming a held search | Your game's UI and flow |
| Telling terminal errors apart from recoverable ones | Deciding what to show the player |
The SDK never holds your API key
Your Pairiquium API key stays on your backend. The SDK calls an endpoint you run, and that endpoint calls Pairiquium. Never put the key in a game build. See Generate a Ticket.
Requirements
- Unity 2021.3 LTS or newer.
- Windows or Linux desktop builds. The default transport uses
System.Net.WebSockets. WebGL is not supported, and consoles need their own transport (see Custom Providers & Platforms). - A backend endpoint that mints tickets. The SDK needs one URL it can POST to; see Ticket Endpoint.
- A Pairiquium account with at least one game mode. See Account Setup and Game Modes.
How it fits together
sequenceDiagram
autonumber
participant C as Game client
participant B as Your backend
participant P as Pairiquium
C->>B: Log in
B->>P: POST /v1/tickets (with your API key)
P-->>B: ticket and wsEndpoint
B-->>C: ticket and wsEndpoint
C->>P: Open WebSocket (wsEndpoint?ticket=...)
C->>P: begin_search
par When a match is made
P-->>C: MATCH_FOUND (matchId, team)
and
P->>B: POST match webhook
endYour ticket provider covers the first four messages: your game asks your backend for a ticket, and your backend gets one from Pairiquium. From opening the WebSocket onward, the SDK does the work. The match webhook is a separate server-to-server call that the SDK never sees; see After a Match.
In this guide
- Install: add the package to your project.
- Ticket Endpoint: the one endpoint your backend needs.
- Quick Start: your first search in a few lines of C#.
- Events & States: what the SDK tells your game.
- Error Handling: terminal and recoverable errors.
- Parties: queueing friends together.
- Automatic Behaviour: pings, heartbeats, reconnects, and tuning.
- After a Match: getting players to a game server.
- Custom Providers & Platforms: your own tickets or transport.
- Samples & Troubleshooting: working examples and common problems.
Next
Start with Install.