Quick start — Unity
Connect a Unity 2021.3+ project to a running Asobi server in about five minutes. You'll register a player, open a WebSocket, queue for a match, and receive server-authoritative state. Don't have a server yet? Run the server quickstart first.
1. Install the SDK
In Unity: Window → Package Manager → + → Add package from git URL, paste:
https://github.com/widgrensit/asobi-unity.gitFor pinned releases append #v0.1.0 (or whichever tag you want). Verify the install via Asobi appearing under Packages in the Project window.
2. Configure the client
Drop this on a bootstrap MonoBehaviour:
using Asobi;
using UnityEngine;
public class AsobiBoot : MonoBehaviour
{
public string Host = "localhost";
public int Port = 8080;
public bool UseSsl = false;
public AsobiClient Client { get; private set; }
void Awake()
{
Client = new AsobiClient(Host, Port, useSsl: UseSsl);
DontDestroyOnLoad(gameObject);
}
}3. Authenticate
For development, register a player by username/password. Production builds should use a platform provider — see Auth & rate limiting.
async void Start()
{
var auth = await Client.Auth.RegisterAsync("player1", "secret123", "Player One");
Debug.Log($"Logged in as {Client.PlayerId}");
}Auth requests are rate-limited at 5/sec per IP — bursting will return 429 rate_limited.
4. Open the WebSocket and queue
Client.Realtime.OnConnected += () => Debug.Log("WS connected");
Client.Realtime.OnMatchmakerMatched += data =>
Debug.Log($"Matched: {data.MatchId} with {data.Players.Length} players");
Client.Realtime.OnMatchState += state =>
Debug.Log($"Tick {state.Tick}: {state.Players.Count} players");
await Client.Realtime.ConnectAsync();
await Client.Realtime.AddToMatchmakerAsync("arena");5. Send input
// Movement input — the server runs your game module's handle_input callback.
await Client.Realtime.SendMatchInputAsync(
"{\"action\":\"move\",\"x\":1,\"y\":0}");Input is fire-and-forget. The next OnMatchState frame will reflect the server's authoritative response.
What's next
- Full SDK reference — every method on every namespace.
- asobi-unity-demo — a working multiplayer arena shooter.
- game.* Lua API — write the server-side gameplay your client connects to.
- Live-edit your game — change
match.luawithout reconnecting the client.