Skip to content

Quickstart

PairKit turns any phone into a Unity controller. No app on the player’s side; they scan a QR code, a web controller opens in their browser, and your Unity scene receives input over a hosted relay.

This page is the shortest path from a fresh Unity project to that working. Target time: 5 minutes.

Requirements

  • Unity 2022.3 LTS or Unity 6000.x (other 2022.x versions also work).
  • A phone on the same network as your computer for local testing — or any internet connection if you point at the hosted relay.

Install

Open your Unity project, then Window → Package Manager → + → Add package from git URL… and paste:

https://github.com/mooumari/PairKit.git?path=/sdks/unity

Unity pulls in com.unity.nuget.newtonsoft-json automatically. No other dependencies.

60-second walkthrough

  1. Create a template asset. Assets → Create → PairKit → Templates → D-pad + Buttons. Save it anywhere in your project.
  2. Add the manager component. Make an empty GameObject, then Add Component → PairKit → Phone Controller Manager.
  3. Drag your template asset into the manager’s Template slot.
  4. Paste your API key into the API Key field. Generate one at app.pairkit.dev/dashboard — sign up, create an app, click Generate. The custom inspector links to the dashboard if the field is empty. (LAN mode skips this step — the field is unused.)
  5. Press play. The Inspector now shows a session code, a scannable QR code, and a live player list. Scan the QR with your phone — the controller opens in your phone’s browser.

You’re connected. Move the d-pad on your phone; it fires events into Unity. The next snippet wires those events to a moving cube.

Make something move

using PairKit;
using UnityEngine;
public class MoveWithPhone : MonoBehaviour
{
[SerializeField] private PhoneControllerManager manager;
void Awake()
{
manager.OnPlayerJoin += p => Debug.Log($"{p.DisplayName} joined");
manager.OnInput += (player, evt) =>
{
if (evt.WidgetId == "dpad")
{
var dir = evt.GetVector2(); // (x, y) in [-1, 1]
transform.position += new Vector3(dir.x, 0, dir.y) * Time.deltaTime * 5f;
}
else if (evt.WidgetId == "btn_a" && evt.EventType == "press")
{
manager.SendToPlayer(player.Id, "vibrate", new { duration_ms = 120 });
}
};
}
}

Attach this to the cube (or any GameObject). Reference the PhoneControllerManager you set up. Press play, scan the QR, push d-pad up — the cube moves. Press the A button — the phone vibrates.

That’s the magic moment. Everything else is variations on this loop.

What’s next

Troubleshooting

If the QR doesn’t scan or the phone fails to connect, see Troubleshooting — most issues are network-related and have a one-line fix.