Discover how Edgegap works

Discover how Edgegap works

/

Netcode for GameObjects

Netcode for GameObjects

Deploy to Edgegap

Published

Published

Published

Last reviewed for accuracy

Last reviewed for accuracy

Last reviewed for accuracy

Netcode for GameObjects: How to integrate and host dedicated servers, and add Matchmaking to your multiplayer game

Netcode for GameObjects: How to integrate and host dedicated servers, and add Matchmaking to your multiplayer game

This guide shows you how to host a game built with Netcode for GameObjects (NGO), Unity's own netcode, on Edgegap's dedicated game servers, then add matchmaking so players are grouped and connected to a server near them automatically.

Once your game server is containerized, Edgegap deploys it worldwide to 615+ Edge Cloud locations (on-demand) from a simple API call and billed exclusively on usage: no entire server to rent, provision or keep running between matches. For persistent servers of reserved capacity, Edgegap offers Private Fleets. Edgegap's Matchmaking builds on top of that and is optional.

This guide covers:

  1. Preparing Unity, your Edgegap account and a containerization tool

  2. Connecting your coding agent to Edgegap (optional)

  3. Getting your NGO game ready for dedicated servers

  4. Building and containerizing your game server

  5. Deploying a test server and connecting to it

  6. Adding matchmaking (optional)

  7. Testing the full loop with two players

You can do it two ways, and mix them:

  • With a coding agent. Connect Claude Code, Cursor or another agent to the Edgegap MCP server and its agent skills. The agent edits your project, builds and containerizes the server, deploys it and writes the matchmaking code. You handle the clicks in Unity and the Edgegap dashboard, and playtest.

  • By hand. Every step below also works without an agent.

For building and containerizing the server, Edgegap's automated game server build tool plugin for Unity is optional. It builds your server, containerizes it and deploys it to the cloud from buttons in the Unity Editor, the quickest way to see your server online for the first time (step 4, Option A).

Here, we use Unity's Boss Room sample, a co-op game built on NGO. Out of the box, Boss Room runs host/client: one player hosts and the others join through Unity's sessions. Steps marked Boss Room cover what's specific to it. Any NGO project works the same way.

No credit card required. Free tier includes the resources to deploy a real game server.

No credit card required. Free tier includes the resources to deploy a real game server.

Step-by-Step Guide

Detailed Integration Steps

1. Before you start

  • A free Edgegap account. Verify your email. No credit card is needed to test.

  • Unity Engine with the Linux build modules installed. Edgegap recommends an LTS version.

    • Add these modules from Unity Hub: Linux Build Support (Mono), Linux Build Support (IL2CPP) and Linux Dedicated Server Build Support. Restart Unity after adding them.

    • Boss Room: use Unity 6.0 LTS, the version the sample is built on. Unity hasn't updated Boss Room for Unity 6.3 LTS or later, so newer versions can break it. Your own NGO project can use any LTS version.

    • Boss Room: also install Git LFS and run git lfs install before cloning. Without it, the sample's art assets don't download and the project opens empty.

  • A containerization tool, running. We recommend Docker Desktop, installed and running while you build.

    • Other container tools work with Edgegap too, but this guide only covers Docker.

  • For the agent path: an Edgegap API token, from Dashboard → User Settings → Tokens. It is organization-wide, so treat it like a password: never put it in your project, your game client or a chat.

Git: Unity needs a Git client (2.14.0 or newer) on your PATH to install packages from a Git URL, such as the Edgegap plugin. macOS usually has one already (Xcode Command Line Tools); on Windows, install Git.

2. Connect your coding agent to Edgegap

Skip this step if you're doing everything by hand.

The Edgegap MCP server lets your agent create apps and versions, deploy servers, read logs and generate matchmaker configurations on your account. The agent skills give it the tested Unity workflow, C# templates (including the NGO adapter), the Dockerfile and the known pitfalls.

Claude Code (run in your own terminal, so the token never passes through the chat):

claude mcp add --transport http edgegap https://mcp.edgegap.dev/mcp -H "Authorization: token YOUR_EDGEGAP_API_TOKEN" --scope user

Then install the skills: /plugin marketplace add edgegap/edgegap-agent-skills, then /plugin install edgegap@edgegap. Restart the session.

Cursor, VS Code and other clients that send headers: add https://mcp.edgegap.dev/mcp with the header Authorization: token YOUR_EDGEGAP_API_TOKEN, and install the skills with npx skills add edgegap/edgegap-agent-skills --skill "*".

Claude Desktop: custom connectors can't send the header, so use the local server instead (Node 18+): { "mcpServers": { "edgegap": { "command": "npx", "args": ["-y", "@edgegap/mcp"] } } }. It asks for the token on first use.

Check it works:

"List my Edgegap apps."

An empty list is fine. An error about the token usually means the header reads token token ....

3. Get your NGO server ready for dedicated hosting

On Edgegap, no player hosts the match. A headless dedicated server owns the game, so the dedicated server must start on its own, listen on a fixed port and stop when the match is over.

With your agent:

"Load the edgegap-unity skill and make this Netcode for GameObjects project dedicated-server ready: server builds call StartServer headless on 0.0.0.0, players spawn when clients connect, Relay and Lobby calls are removed from the server path, and the server stops itself when the match ends. Add the Edgegap server lifecycle and matchmaking client scripts with the NGO adapter. Then check it still works locally with one server and one client."

By hand, in your project:

  • In server builds, call NetworkManager.StartServer(), never StartHost(). Nothing on the server path should wait for a menu or a button.

  • Keep Unity Transport's port, 7777/UDP by default, and have the server listen on all interfaces: SetConnectionData("0.0.0.0", port, "0.0.0.0").

  • Spawn players when clients connect (the Network Manager's Player Prefab, or OnClientConnectedCallback), not a local player for the host.

  • Remove Unity Relay, Lobby or session calls from the server path. Keep a direct IP connection for testing.

  • Make sure the scene with the Network Manager is enabled in Build Settings. Only enabled scenes get built.

  • Set Application.targetFrameRate (30 to 60) on the server, or the headless build spins a CPU core at 100%.

Boss Room

The base sample starts the host through Unity's sessions and its own ConnectionManager, so it can't run as a dedicated server as is. Two ways in:

  • Convert the base sample with your agent. Clone Unity's Boss Room with Git LFS, then use the prompt above and add: "Route the server start and client connections through Boss Room's ConnectionManager (its IP connection methods) instead of calling the NetworkManager directly."

  • Or start from Edgegap's Boss Room fork. It's already dedicated-server ready: the server calls StartServer instead of StartHost, and an EdgegapServerStarter in the MainMenu scene starts it on 0.0.0.0, on the port Edgegap passes to the container. The Edgegap plugin is already included. The fork also adds a Matchmake button that calls Unity's UGS Matchmaker: to keep UGS Matchmaker and have it deploy servers on Edgegap, follow our UGS Matchmaker guide. This guide uses Edgegap's matchmaker instead (step 6).

On first open, the fork may start in Safe Mode. Install Multiplayer Services from Window → Package Manager → Unity Registry, then check the Console shows no compile errors.

Test locally first: one Editor (or build) as the server, one as a client, with Unity's Multiplayer Play Mode. Don't containerize a game that doesn't work on localhost.

4. Build and containerize your server

Edgegap runs your Linux server build inside a container. Use either option, or both: for example, the plugin for your first deploy and your agent for every build after that.

Option A (optional): Edgegap's automated game server build tool plugin for Unity. The quickest way to a first cloud deploy, all from buttons. It uses Docker to containerize your server. The video below shows this path on Edgegap's Boss Room fork.

  1. In Unity, select Window → Package Manager, select +, then Add package from git URL, and paste https://github.com/edgegap/edgegap-unity-plugin.git. (Edgegap's Boss Room fork already includes it.)

  2. Open Tools → Edgegap Server Hosting, sign in, and paste the token it gives you under Connect your Edgegap Account. Select Validate Token.

  3. Check your scenes in Build Settings. For Boss Room, Startup comes first, then MainMenu, then the gameplay scenes.

  4. Select Build Server. The build lands in Builds/EdgegapServer/ServerBuild.

  5. With Docker running, select Validate, then Containerize with Docker. Optionally, Deploy Local Container and connect a client to it.

  6. Select Upload Image and Create App Version. In the browser, set the port to match your transport: 7777, UDP, named gameport. Submit.

Option B: ask your agent.

"Build the Linux dedicated server, containerize it with the edgegap-unity Dockerfile for linux/amd64, push it to my Edgegap Container Registry with a new tag, then create the app and app version with port 7777 UDP named gameport."

The agent asks you to run docker login registry.edgegap.com yourself, with the username and token from the Container Registry page, so those credentials stay out of the chat. Make sure the app version has the registry credentials set: without them, deployments fail with "Unable to pull image from registry".

Use a new image tag for every build, never latest.

Here's our video tutorial for Edgegap's plugin for Unity, using Edgegap's Boss Room fork:

5. Deploy a test server and connect

Start one server by hand to prove the image, the port and your netcode work before adding matchmaking. Any of these works:

  • From the plugin: choose your app and version, then select Deploy to Cloud.

  • From the dashboard: open your app version in the Edgegap dashboard, select Deploy, pick a location close to you, and deploy.

  • From your agent: "Deploy my latest Edgegap version near me, wait until it's ready, show me the logs, and give me the IP address and external port."

When the deployment is Ready, copy its Host IP and External Port. Use the IP, not the host name: Unity Transport expects an IP address. Set them as the client's connection data on Unity Transport, then press Play. Boss Room: select Join with IP, and enter the IP and the external port. The external port changes on every deployment, so read it each time. The server can take up to a minute after Ready to accept players.

Stop the deployment when you're done (Stop Last Deployment in the plugin, or ask your agent). The free tier runs one deployment at a time, and a forgotten test server blocks matchmaking.

Here, you picked the location and handed out the address. To group players and start a server near them automatically, add a matchmaker.

6. Add matchmaking

Edgegap's matchmaker is a hosted service: players send a ticket, it groups them by your rules (match size, teams, latency, skill, mode), deploys your server near them and returns the address to every client.

With your agent:

"Generate an Edgegap matchmaker configuration for my app version: one team of 2 to 4 players, and let a lone player get a server after 30 seconds so I can test alone. Save it as matchmaker-config.json."

Then, in the dashboard (this step has no API):

  1. Open Matchmaker and select Create Matchmaker.

  2. Name it, upload matchmaker-config.json, and select Create and Start.

  3. When it's ONLINE, copy the API URL and the Auth Token. The Auth Token is safe to ship in your game client: it gives no access to your Edgegap account.

Back with your agent:

"Put the matchmaker API URL and Auth Token on EdgegapMatchmakingClient, wire my Play button to FindMatch, then rebuild and push the server, create a new app version and tell me what to update in the matchmaker."

Boss Room: ask the agent to connect matched players through Boss Room's ConnectionManager IP connection, so the sample's connection payload and character select still work. On Edgegap's fork, it can replace the UGS Matchmake button or sit next to it.

By hand: follow the Unity matchmaking guide in our documentation.

When you ship a new server build, update application.version in the matchmaker configuration (Stop, Edit, Start), or matches keep deploying the old build.

7. Test the full loop with two players

  1. Make sure no test deployment is still running.

  2. Run two clients: the Editor plus a build, or two Multiplayer Play Mode players.

  3. Select Find Match in both. The status goes from searching to match found to host assigned, then both clients connect to the same server.

  4. Leave the match. The server logs that it's stopping, and the deployment disappears from the dashboard. That self-stop is what keeps your bill at zero when nobody plays.

On the free tier, the matchmaker stops 3 hours after each start (restart it from the dashboard), deployments stop after 60 minutes, and one deployment runs at a time.

Next Steps

Next Steps

Already on Unity Gaming Services? Keep UGS Matchmaker and have it deploy your servers on Edgegap: see our UGS Matchmaker guide. Prefer lobbies players browse? See the Server Browser for Unity.

Going live? Ask your agent to run the edgegap-launch skill's checklist: version rollouts, restart policy, maximum duration, cost control.

Stuck? Ask your agent to load edgegap-troubleshoot, or ask our team and other studios on the Edgegap Discord.

Frequently Asked Questions

Common questions about hosting a Netcode for GameObjects game on Edgegap's dedicated servers, with or without matchmaking.

Does Netcode for GameObjects support dedicated servers?

Yes. Build for Linux Dedicated Server, call StartServer() instead of StartHost() in server builds, and spawn players when clients connect. The server then runs headless with no player hosting.

Which port does Netcode for GameObjects use on Edgegap?

Whatever Unity Transport listens on, 7777 over UDP by default. Set the same port and protocol on your Edgegap app version, named gameport. Players connect to the deployment's IP and the external port Edgegap assigns to it.

Can Unity's Boss Room sample run on a dedicated server?

Not out of the box: it runs host/client through Unity's sessions. A coding agent with the Edgegap skills can convert it, or you can start from Edgegap's Boss Room fork, which already runs as a dedicated server. Use Unity 6.0 LTS for Boss Room.

Can I keep Unity's UGS Matchmaker and host on Edgegap?

Yes. UGS Matchmaker can call Edgegap's API to deploy a dedicated server for each match. Our UGS Matchmaker guide covers it.

How much does it cost to host a Netcode for GameObjects game server?

Testing is free, with no credit card. After that, Edge Cloud bills per vCPU per minute only while servers run, so a server that stops at the end of each match costs nothing between matches.

Clients

Learn more from clients who integrated Edgegap

31 case studies are available from studios that moved to Edgegap from another platform.

Key reasons why they chose Edgegap

Discover the impact of Edgegap's automated game server orchestration for a flawless multiplayer experience.

Cost

Pricing

Optimize costs and performance with hybrid orchestration

Optimize costs and performance with hybrid orchestration

Optimize costs and performance with hybrid orchestration

Edge Cloud

On-Demand

$0.00115

/ vCPU

/ MINUTE

Billed by the Minute, Only on Usage

Pay only when players play. 0 active servers = $0

Deploy game servers worldwide, per instance, to all 615+ edge cloud locations. Zero commitment.

Simply add a credit card.

Edge Cloud

On-Demand

$0.00115

/ vCPU

/ MINUTE

Billed by the Minute, Only on Usage

Pay only when players play. 0 active servers = $0

Deploy game servers worldwide, per instance, to all 615+ edge cloud locations. Zero commitment.

Simply add a credit card.

Private Fleet (Bare Metal)

Reserved Capacity

$0.0282

/ vCPU

/ HOUR

Billed Monthly, Always On

$280 per host/month (12 mo rate), or $350 monthly

Optimize the cost effectiveness of your game server with egress-free hosting of Private Fleets.

Persistent, available 24/7, exclusive to your studio.

Private Fleet (Bare Metal)

Reserved Capacity

$0.0282

/ vCPU

/ HOUR

Billed Monthly, Always On

$280 per host/month (12 mo rate), or $350 monthly

Optimize the cost effectiveness of your game server with egress-free hosting of Private Fleets.

Persistent, available 24/7, exclusive to your studio.

Your bill varies per rate and usage; which can vary per game type, player count, & more.

Your bill varies per rate and usage; which can vary per game type, player count, & more.

Model your usage with our estimate calculator ->

Model your usage with our estimate calculator ->

Edgegap's features & price: detailed comparison between Edge Cloud & Private Fleets

Edgegap's features & price: detailed comparison between Edge Cloud & Private Fleets

COMPARE

Free Trial

Edge Cloud

Private Fleets

FEATURES

Analytics & Monitoring

Billing Alarms

Click to Expand

28 more rows

Unlocks

Capabilities are unlocked when a credit card is added to the account.

COMPARE

Free Trial

Edge Cloud

Private Fleets

FEATURES

Analytics & Monitoring

Billing Alarms

Click to Expand

28 more rows

Unlocks

Capabilities are unlocked when a credit card is added to the account.

COMPARE

Free Trial

Edge Cloud

Private Fleets

FEATURES

Analytics & Monitoring

Billing Alarms

Click to Expand

28 more rows

Unlocks

Capabilities are unlocked when a credit card is added to the account.