# Edgegap’s Dedicated Game Server Hosting – Plugin Guide

Edgegap helps you build and launch a dedicated game server in the cloud directly from Unity’s editor, without almost any coding or Linux/Cloud usage whatsoever. Which helps make game server hosting easy!

*Thanks to Edgegap’s dedicated game server hosting plugin for Unity, Mirror users get 1.5 vCPU of cloud hosting for free with Edgegap’s free trial!*&#x20;

## Overview

Integration of Edgegap is simple and takes a few minutes with 3 basics steps:

1. Installing Unity dependencies & Docker
2. Installing the Unity plugin & creating a free account on [Edgegap](https://app.edgegap.com/)
3. Configuring, building & pushing the server to Edgegap

Edgegap’s plugin walks you, step-by-step, making it the easiest way to add dedicated game server in Unity.

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FSspy4lAuzYxgH1MDO0DJ%2F00%20-%20Mirror%20Documentation%20-%20Plugin%20Overview%20copy.png?alt=media&#x26;token=e4024d65-b7db-47eb-a571-9c63ca4f35a8" alt="" width="563"><figcaption></figcaption></figure></div>

## Setting Up your Project

{% hint style="warning" %}
If you are installing a new project, rather than installing the latest version, we strongly recommend using the “LTS” (Long Term Service) version of Unity for your project, i.e., Unity 6.0 (6000.0.60f1) as of writing. This ensures compatibility with tools & services, and long-term support of Unity’s version for your projects.
{% endhint %}

**1. Installing Linux Build Support**

From your **Unity Hub**, select **Installs**, select the **Manage** icon next to the Unity version you intend to use in your project and click **Add Modules**:

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FOcg5CJr5gYHWrCfKVBmS%2F01%20-%20Mirror%20Documentation%20-%20Install%20Linux%20Build%20Support%20-%20Unity%20Hub.png?alt=media&#x26;token=fae0efd1-347d-41c7-8fea-e3c053940b2f" alt=""><figcaption></figcaption></figure></div>

Make sure to install all three of Unity’s Linux Build Support Modules. Namely:&#x20;

* Linux Build Support (IL2CPP), Linux Build Support (Mono), Linux Dedicated Server Build Support,

Additionally, depending on your target platform OS, you will need to add:

* **Windows**: Windows Build Support (Mono)
* **Mac**: Mac Dedicated Build Support (IL2CPP) and Mac Dedicated Server Build Support
* **WebGL**: Web Build Support

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2F7rIuxFt4GiA7e2W5cFb3%2F03%20-%20Mirror%20Documentation%20-%20Install%20Linux%20Build%20Support%20-%20Modules.png?alt=media&#x26;token=84d91d1e-62ec-4dbb-a628-1ee24265e2ee" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %}
For users with new projects, which modules to add will be prompted when selecting which version to install. Make sure to add it there. However, you can return at any time to add them as shown above.
{% endhint %}

**2. Installing Docker**

Edgegap uses containers, which is a virtualization that ensures to can run on any hardware, anywhere in the world.&#x20;

Any containerization tool should work, but the easiest is to use Docker Desktop:

<https://www.docker.com/products/docker-desktop/>

Simply download it, install it, restart the dev machine, then open it (if it doesn’t open automatically at boot time. Then run it in the background.

## Installing the Unity plugin

From the top navigation menu in Unity, select **Window**, then **Package Manager**.

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FLTJ5R8KQU3JttmXOkY5U%2F04%20-%20Mirror%20Documentation%20-%20Install%20Plugin%20-%20Window.png?alt=media&#x26;token=4a426c18-78c3-4290-9abd-483201f9e919" alt="" width="563"><figcaption></figcaption></figure></div>

Within the Package Manager, click on the "+" icon, then select **Add Project from Git**.

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2Fy1opZlc8gC9oMSDZDt84%2F05%20-%20Mirror%20Documentation%20-%20Install%20Plugin%20-%20Install%20Package%20from%20git%20URL.png?alt=media&#x26;token=2d87e51d-5ffb-4eb1-97a3-732411251bc8" alt="" width="462"><figcaption></figcaption></figure></div>

Paste Edgegap's Unity plugin URL:&#x20;

<<https://github.com/edgegap/edgegap-unity-plugin.git#partner/mirror-source>>

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2Fmk42K5RIde4tWsPNI9CV%2F06%20-%20Mirror%20Documentation%20-%20Install%20Plugin%20-%20Git%20URL.png?alt=media&#x26;token=c9746ad9-a3d4-4ce7-9671-48169ab39d00" alt=""><figcaption></figcaption></figure></div>

Select **Install**.

That’s it!

From the top navigation bar, select **Tools** and then open the plugin by clicking on **Edgegap Server Hosting**.

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FxreVHDakbTvC8ptjZk1U%2F07%20-%20Mirror%20Documentation%20-%20Open%20the%20Plugin.png?alt=media&#x26;token=26561d38-c02f-4856-be1e-e3072186a7b9" alt="" width="264"><figcaption></figcaption></figure></div>

The plugin automatically opens up. Select **Sign in with Edgegap** to start the process of creating an account (or sign-in to sync with the platform, for users with active accounts).

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FrAel4y0zUr8Iu8S4BBwr%2F08%20-%20Mirror%20Documentation%20-%20Sign%20in%20with%20Edgegap.png?alt=media&#x26;token=5e414c01-5f5c-4844-8e1a-3585513bcbb8" alt="" width="563"><figcaption></figcaption></figure></div>

## Create a Free Account on Edgegap

Signing up to Edgegap is easy and free. Use your own **Google** or **GitHub** account, or sign-up with an **email**.&#x20;

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FvJdw5KPGRUH2CKPGzMcX%2F09%20-%20Mirror%20Documentation%20-%20Sign%20in%20Screen.png?alt=media&#x26;token=665b158d-25ed-47f9-8965-4e5379104349" alt="" width="320"><figcaption></figcaption></figure></div>

You are now asked to name **Your Organization**.

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FRB9VXlL38Mi12Dyh0PmU%2F10%20-%20Mirror%20Documentation%20-%20Your%20Organization%20Screen.png?alt=media&#x26;token=47331d84-ce15-4029-ad91-f678742a70a3" alt="" width="321"><figcaption></figcaption></figure></div>

Automatically, the **OneClick Token Create Successfully** screen appears. This is your token (blurred here). Simply copy it by clicking on the clipboard icon.

{% hint style="warning" %}
Do not share your token with anyone or on public channels like Discord, as they could deploy game servers on your behalf!
{% endhint %}

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2Fxt9FbryAJjXLeeXvLTfs%2F11%20-%20Mirror%20Documentation%20-%20OneClick%20Token.png?alt=media&#x26;token=595c099f-d980-47da-9522-147dc999c658" alt="" width="375"><figcaption></figcaption></figure></div>

## Configuring, building & pushing the server to Edgegap

**1. Validate your Token**

Return to Unity and paste the token in the field under **1. Connect your Edgegap Account**. Then, select **Validate Token**.

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2F24XX3vcT0kOTRJo1xXJo%2F12%20-%20Mirror%20Documentation%20-%20Plugin%20-%20Validate%20Token.png?alt=media&#x26;token=446681eb-4736-4404-8b9b-e53912fc1b71" alt=""><figcaption></figcaption></figure></div>

**2. Building your Game Server**

After verifying successfully, you optionally can make sure that you have the Linux Server dependencies by clicking on **Install**.&#x20;

Then, select **Edit Settings** to make sure the game scenes you want to include are included.

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FpaTfdLvoolSKif5pXCr4%2F04%20-%20Mirror%20Documentation%20-%20Plugin%20-%20Build%20your%20Game%20Server.png?alt=media&#x26;token=cf10f50a-fcac-4c3c-ad66-505002224f48" alt=""><figcaption></figcaption></figure></div>

Under **Linux Server**, make sure the scenes are listed. If not, select **Open Scene List** and add them manually.

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FhRYkb9bCsIX78hD2qcCX%2F14.A%20-%20Mirror%20Documentation%20-%20Plugin%20-%20Build%20Profile.png?alt=media&#x26;token=bb44c92f-542c-452a-b19f-b2a35cf9f5fa" alt=""><figcaption></figcaption></figure></div>

Additionally, doublecheck that your build set up. Specifically, select **Network Manager** from your project’s hierarchy, and the under **Network Manager**, ensure&#x20;

1. Under **Configuration**, that **Don’t Destroy on Load** is selected (i.e., the ✔)&#x20;
2. **Headless Start Mode** is set to **Auto Start Server**

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FxBc9CpaW3JsPHjQ3h5HJ%2F14.B%20-%20Mirror%20Documentation%20-%20Plugin%20-%20Network%20Manager%20-%20Copy.png?alt=media&#x26;token=7dd85372-e936-4ccb-bb48-9f939143b1dd" alt="" width="273"><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FXGVrXFRgewuMWcd8ILMy%2F14.C%20-%20Mirror%20Documentation%20-%20Auto%20Start%20Server.png?alt=media&#x26;token=b198918e-4c50-4f70-825e-c74eb5f6377d" alt="" width="308"><figcaption></figcaption></figure></div>

Return to the plugin and select **Build Server** to start the build process. You should see “Build succeeded” in green when complete.&#x20;

**3. Containerize your Game Server**

First, make sure Docker is running by selecting **Validate**.  You should see “Docker is running” in green.

While you may want to change the image name, build path, and tags in the future, we recommend skipping this entirely and select **Containerize with Docker** button to start the containerization process.&#x20;

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2Fhr71oOjBzOjmQZiPODHL%2F15%20-%20Mirror%20Documentation%20-%20Plugin%20-%20Containerize.png?alt=media&#x26;token=48518ea1-0925-4b99-a476-2c3a8333c8b1" alt=""><figcaption></figcaption></figure></div>

After a short wait, you should see “Containerization succeeded” in green.&#x20;

**4. (Optional) Test your Server Locally**

Optionally, you can test your container locally by selecting **Deploy Local Container**. You may configure the server image tag, and Docker run parameters, but we recommend skipping this initially.&#x20;

If it succeeds, you should see “Container deployed successfully” in green.&#x20;

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FRFrOxTNJ75qWbSmJk6uH%2F16%20-%20Mirror%20Documentation%20-%20Plugin%20-%20Test%20Locally.png?alt=media&#x26;token=993c2ec2-807a-4380-a829-70d2b6213168" alt=""><figcaption></figcaption></figure></div>

The container should be visible within the “Container” tab in Docker Desktop.&#x20;

**5. Upload to Edgegap**

Now we’ll upload the game server to Edgegap’s registry so they can deploy it to their cloud network.&#x20;

Application name, server image name and server image tag are all pre-filled. While all can be edited, we suggest to keep things as-is for now.&#x20;

Select **Upload Image and Create App Version** button, which automatically uploads the build to Edgegap’s platform.

{% hint style="info" %}
Older images on your dev machine can be uploaded. Find the docker image name and tag in Docker Desktop under images tab.
{% endhint %}

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FI5zsgw6vmbHjSDr0IwcW%2F17%20-%20Mirror%20Documentation%20-%20Plugin%20-%20Upload%20to%20Edgegap.png?alt=media&#x26;token=8394130d-54b2-400c-b9b4-1f0674667d7c" alt=""><figcaption></figcaption></figure></div>

After a bit of loading, a new web browser will open. This is your application’s **Version** parameters. You can customize the version’s name, resources parameters, and more.&#x20;

For now, click on **Submit** to create your version.&#x20;

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2F4juTZv3oMoEkFc9IteCm%2F18%20-%20Mirror%20Documentation%20-%20Plugin%20-%20App%20Version.png?alt=media&#x26;token=7c29a257-3fff-4320-b9bd-3559ea6b8c14" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %}
Resources optimization is key to limit overall cloud usage. Edgegap offers vCPU fractioning, which means you can reduce your game server down to ¼ of a vCPU. When ready, make sure to check out Edgegap’s [analytics](https://app.edgegap.com/analytics/dashboards/list) and recommended [server builds optimization](https://docs.edgegap.com/learn/unity-games/getting-started-with-servers#optimize-server-builds) strategy
{% endhint %}

Then, the **Create Port** screen appears. Here you can change the **port**, and the **protocol type**. If you use KCPTransport the default port of 7777 and UDP.

{% hint style="info" %}
If you are working on a WebGL project, then use 7778 and WS protocol. For other transports, select the corresponding protocol an port configured in Network Manager in your server build.
{% endhint %}

Select **Submit** to create your deployment.

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FRJb35F89EMFqPCUK4JfK%2F19%20-%20Mirror%20Documentation%20-%20Plugin%20-%20Create%20Port.png?alt=media&#x26;token=28e23aba-af46-40cd-92ec-6b217cf93ab0" alt="" width="375"><figcaption></figcaption></figure></div>

**6. Deploy to Cloud**

The final step is to select which version to deploy to Edgegap’s cloud network. Here, your latest application will be preset but can be changed. You must manually select **Application Version** by simply clicking on the drop down (the ▼ on the right) and the latest versions will be shown, here in the image highlighted in green:

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FNWucXBvD5n3bCDBN8qwA%2F20%20-%20Mirror%20Documentation%20-%20Plugin%20-%20Deploy%20to%20Cloud.png?alt=media&#x26;token=741beac7-8789-4264-9537-0e4fc2429054" alt=""><figcaption></figcaption></figure></div>

Once selected, simply select **Deploy to Cloud**.&#x20;

This automatically opens your deployments’ page on the Edgegap’s platform. After a few seconds, the deployment will change from “deploying” to “ready”.&#x20;

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FS1rSvAG2h7g4SPNEpV4E%2F21%20-%20Mirror%20Documentation%20-%20Plugin%20-%20Deployment%20Dashboard.png?alt=media&#x26;token=49c71c29-4923-4f2a-a786-5b8fee02316d" alt=""><figcaption></figcaption></figure></div>

Once that’s done, click on the deployment. This opens up the **Deployment Details** page. Scroll down and make sure to note the **Host URL** alongside the **External Port**.&#x20;

Copy the Host URL using the clipboard.

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FY9DBJ0Z3uaIQgNLMCucs%2F22%20-%20Mirror%20Documentation%20-%20Plugin%20-%20Deployment%20Host%20URL%20%26%20External%20Port.png?alt=media&#x26;token=b4b6da02-1790-4489-a80b-183375347b4c" alt="" width="361"><figcaption></figcaption></figure></div>

{% hint style="info" %}
While internal ports for the server process are defined as part of app version, external ports are assigned at random once a deployment is created, so that a potential malicious party (hacker) is slowed down and detected before they can cause damage.
{% endhint %}

Back in Unity, select the **Network Manager** from your project’s hierarchy.

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FaHfNLXm0QjdmzEwYgJoC%2F23%20-%20Mirror%20Documentation%20-%20Plugin%20-%20Network%20Manager.png?alt=media&#x26;token=4bafe67d-6e8b-4145-a70c-642163a1bcdf" alt="" width="409"><figcaption></figcaption></figure></div>

Within the **Inspect Tab**, make sure to set:

1. Paste the **Host’s URL** from the deployment to the **Network Address**&#x20;
2. Replace the default **Port** (usually 7777) to the **External Port** from the deployment

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FWlER1CsHLumaIEOCBMVY%2F24%20-%20Mirror%20Documentation%20-%20Plugin%20-%20Network%20Manager%20Inspector.png?alt=media&#x26;token=e5fbc617-0465-4d5c-96fd-7c9f097e3d45" alt="" width="450"><figcaption></figcaption></figure></div>

Then launch the scene in Unity Editor, and test the project:

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FB2P6KcFe7oqtzOPHQLug%2F25%20-%20Mirror%20Documentation%20-%20Plugin%20-%20Test%20Scene.png?alt=media&#x26;token=bf8757d1-b645-4fff-af3a-81e5e139a56c" alt=""><figcaption></figcaption></figure></div>

{% hint style="success" %}
It's important to understand the magic that is happening here.

Not only can you launch a game server with Two Clicks now.

You can even launch thousands of servers with another click on Edgegap's website! 🤩
{% endhint %}

To reduce costs (if you are paying), you can press **Stop Last Deployment** in the plugin once you are done.

<div align="left"><figure><img src="https://462154250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MGmQrf2z6FL0ZpExPAn%2Fuploads%2FR9JPPCTcSc1QZAItFMjb%2F26%20-%20Mirror%20Documentation%20-%20Plugin%20-%20Stop%20Last%20Deployment.png?alt=media&#x26;token=8355c307-faa2-4f7e-aabe-5db62314f2a4" alt=""><figcaption></figcaption></figure></div>

## Troubleshooting Connection Issues

If your Server Status says **Ready** but you can't seem to connect, try this:

* On the Edgegap website, go to Deployments -> select your Deployment -> select **Container Logs**, check the log files to see if your game server launched or if there are issues.
* If it says "exec user process caused: no such file or directory": this can happen if you pushed an ARM build to Edgegap's x86 infrastructure. We already updated the plugin to properly cross compile from ARM so this generally should not happen anymore.
* If everything seems fine but you still can't connect, please talk to an Edgegap employee in the Mirror Discord's **#edgegap** channel.
