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!
Heads up! Free Tier deployments have a 1-hour runtime limit. If you need longer deployment, consider upgrading to the Pay-as-you-go Tier for flexible usage. View Tiers
Prerequisites
To use the Edgegap Unity Package, you must have:
An Edgegap API token.
An application to deploy. See this tutorial.
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
Git clone this project.
git clone https://github.com/edgegap/edgegap-unity-plugin
Open the project with Unity Hub
Export the package under
Assets > Export Package...
and remove the default scene from the selection.Save the
.unitypackage
In your Unity Editor, go to
Assets > Import Package > Custom Package...
and navigate to the.unitypackage
file.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 underPlugins
is theDLL
file forNewtonsoft.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 haveNewtonsoft.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
Enter your Edgegap API key (including the
token
part), choose your API environment and enter an app name and version, then click theConnect
button. You may use theDocumentation
button to open this page in your browser at any time.
You can start your game server when connected using the
Start Server
button.
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.
Make sure you are logged in to your registry with Docker using the
login
command:
Create a Dockerfile at the root of your project. For more information on the Dockerfile, see how to create one here.
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
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.
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:
You are not connected to your registry, so try to
docker login your.registry.com
with your credentials to login to your registry.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 todocker login
to login.
Last updated
Was this helpful?