PlayFab MPS Mirror
PlayFab's Unity Mirror Multiplayer Servers sample, moved to Edgegap: no GSDK, servers started on request near the players, and an allocator tool on the Edgegap API.
Explore how to move a game server from PlayFab Multiplayer Servers (MPS) to Edgegap with the PlayFab MPS Mirror sample, a fork of Microsoft's MpsSamples where the UnityMirror sample runs on Edgegap.
There is no matchmaker in this sample. You start a server with a small command-line tool, the counterpart of PlayFab's MpsAllocatorSample, and connect clients to the address it prints. The server stops itself when the players leave.
This sample shows:
Unity 2021.3.45f2 server and client on Mirror (Telepathy, TCP 7777), the server built as a Linux dedicated server with the Edgegap Unity plugin,
no GSDK: the server listens on a fixed port at startup, with no agent, heartbeat or ready call,
EdgegapAllocatorSample: a .NET console app that starts a server near the players and waits for its address, lists versions and deployments, and stops a deployment, using the Edgegap API,
server self-stop: the server stops its own deployment when nobody joins, or after everyone has left.
πΊοΈ From MPS to Edgegap
GSDK Start, ReadyForPlayers, listen on OnServerActive
Listen on the fixed port 7777 at startup (EdgegapServer.cs).
Port from GetGameServerConnectionInfo
A fixed internal port on the app version. Edgegap maps it to a public port.
UpdateConnectedPlayers
Not needed. The server only counts players to know when to stop.
OnShutDownCallback
Edgegap sends SIGTERM. Players get the same ShutdownMessage when Unity quits.
Build, VM size, servers per VM, standby servers
App version: the image, 0.5 vCPU / 1 GB per server, port gameport TCP 7777. Nothing is pre-provisioned.
RequestMultiplayerServer
POST /v2/deployments with the players' IPs or coordinates (EdgegapAllocatorSample).
The server runs until MPS shuts it down
The server stops its own deployment through ARBITRIUM_DELETE_URL, injected into every deployment.
βοΈ Preparation
Before we start, you will need:
Unity
2021.3.45f2with Linux Build Support and Linux Dedicated Server Build Support,Docker Desktop, running,
the .NET SDK 8 or newer, for the allocator,
an Edgegap API token from Dashboard β User Settings β Tokens. It stays on your machine or in your backend, never in a game client.
β‘ Deploy and Connect
1. Build and Upload the Server
Open UnityMirror/UnityServer in Unity, then Tools β Edgegap Server Hosting:
Sign in with Edgegap, then Build server.
Containerize with Docker: image name
mps-unity-mirror, image tag empty (the plugin uses the current UTC time).Optional local check: run parameters
-p 7777:7777/tcp, then Deploy local container.Upload to Edgegap: application
mps-unity-mirror, then Upload image and Create app version. In the version form, set one port namedgameport, 7777, TCP, 0.5 vCPU / 1 GB and a max duration of 60 minutes. If the form asks for registry credentials, use the username and token from the dashboard's Container Registry page.
From the command line, for CI or scripted tests:
2. Start a Server
Run the allocator with your token, application and version:
It prints the client argument, for example -server 1a2b3c.pr.edgegap.net:31202, once the server is ready. Without arguments, dotnet run opens a menu to list versions and deployments, or stop a deployment.
3. Connect Clients
Build UnityMirror/UnityClient for Windows, then start it with the address:
Quit the clients: the server stops its deployment 30 seconds after the last player leaves, or 120 seconds after start if nobody joins.
π§ Known Limits
No matchmaker. Servers are started from the allocator or the dashboard. For players, start them from your backend, or use Deploy from PlayFab or the Edgegap Matchmaker.
The server doesn't check who connects. For production, pass the expected players to the deployment as environment variables, and reject others.
Edgegap Unity plugin 3.2.1 prints the environment before the server starts, so the deployment logs show its self-stop token. Remove
env;from the plugin Dockerfile'sCMDif your logs are shared.
Was this helpful?

