Unity Package

The Unity Server Management Tool

This Unity tool is a custom asset we created to simplify the management of your Edgegap servers when you're developing your games in Unity. Currently, it allows you to:

  • Start and stop a game server at will

  • Monitor your game server status in real-time (updated every few seconds)

  • Access your game server address and open ports

All from the Unity editor!

Prerequisites

To use the Edgegap Unity Package, you must have:

Installing the package

From Unity Store

The version on the Unity Asset Store might not be the latest one. To ensure the last version, download it directly from our GitHub (see the From Source section).

You can add to your Assets the latest published version from the Unity Asset Store and import it with the Package Manager under Window > Package Manager then selecting My Assets as the source.

From Source

  1. Git clone this project.

    git clone https://github.com/edgegap/edgegap-unity-plugin

  2. Open the project with Unity Hub

  3. Export the package under Assets > Export Package... and remove the default scene from the selection.

  4. Save the .unitypackage

  5. In your Unity Editor, go to Assets > Import Package > Custom Package... and navigate to the .unitypackage file.

  6. You will see a window with the various files about to be imported into your project. Everything under Edgegap is related to our server management tool, and under Plugins is the DLL file for Newtonsoft.Json.

    If you already have this plugin installed in your project or your Unity version is above 2019.4, you should not import the Plugins folder to avoid duplicates and conflicts in your project files.

    Keep the Plugins folder selected if your Unity version is 2019.4 and you don't already have Newtonsoft.Json in your project.

How to use

You should now find a new "Edgegap" tab in the upper menu. You can open the Edgegap Server Management tool by clicking on Edgegap > Server Management. You can dock this window anywhere in your Unity Editor.

Starting your servers

  1. Enter your Edgegap API key (including the token part), choose your API environment and enter an app name and version, then click the Connect button. You may use the Documentation button to open this page in your browser at any time.

  1. You can start your game server when connected using the Start Server button.

  1. When the server starts, the tool window will display the real-time status of your server and a button to open the deployment in our dashboard through your browser. Once it is up and running, you will have access to the server's open ports, with buttons to quickly copy the links to those ports.

You may stop the server anytime by using the Stop Server button.

Building your server

You cannot Build and Push while a server is running or when you are disconnected.

  1. Make sure you are logged in to your registry with Docker using the login command:

docker login your.registry.com
  1. Create a Dockerfile at the root of your project. For more information on the Dockerfile, see how to create one here.

  2. Click on the Build and Push button to:

    • Unity build your game server

    • Docker build your game server image

    • Docker push to your registry

    • Update your application version tag on Edgegap

  3. Once the task has been completed, you can deploy your new server with the Start Server button!

The utility script

You can find a utility script in the Edgegap/Scripts folder imported with the tool (named EdgegapToolScript) that gives you access to your running server status info.

EdgegapToolScript edgegapToolScript;
Status serverStatus = edgegapToolScript.ServerStatus;

# serverStatus.RequestId
# serverStatus.Ports
# serverStatus.CurrentStatus
# serverStatus.ElapsedTime
# etc.

When attached to a GameObject in the scene, the script's inspector will display the same server status info as the Edgegap tool window and expose a public property containing the server status info.

This display feature lets you get your running server's info or connect to it before having a working matchmaker or server manager.

Common Errors

Error building player because build target was unsupported

This happens when your Unity Editor doesn't have the Linux platform installed. In Unity Hub, click on your project's Editor Version, then click on the Add a platform button. You'll see a list of available platforms. Ensure both Linux platforms are checked and install them if it's not the case.

action: push: unauthorized to access repository: example/my-repository

This could happens for 2 reasons:

  1. You are not connected to your registry, so try to docker login your.registry.com with your credentials to login to your registry.

  2. The user/token cannot Push to this repository. Make sure that your have a Push permission for this user or generate a new token with a push permission. docker logout your.registry.com to remove existing local credentials, then try to docker login to login.

Last updated

Was this helpful?