Unity Plugin Guide
Last updated
Was this helpful?
Last updated
Was this helpful?
This is an early version. If you encounter issues, please report them on our channel.
Setup will take only a few minutes, with 3 basic steps:
Installing Unity Linux Build Support & Docker Desktop
Configuring the Unity Plugin
Building & Pushing our server to Edgegap
The only other official distribution channels for this plugin are:
Once you have it, check for "Tools -> Edgegap Hosting" in Unity's top menu:
The next step is to Get a Token from the Edgegap dashboard.
Simply press the Get a Token button and either login to your existing Edgegap.com account, or press the Get Started link on the page to create a new account.
Next you'll automatically see the Token Created Successfully screen, because we initially clicked the Get Token button in the Unity plugin:
Press the Clipboard icon to copy the token, then paste it back into the Unity plugin and press Verify. Note that the token looks like "token 123456-abcdef-00000-...". The "token ..." part needs to remain in there.
After verifying successfully, enter an Application Name into the field and press Create Application:
It'll say Success and then show you the application details.
Next time you can enter your already created application name and press Load Existing App instead.
The final configuration step: we need to enter the Port and Protocol Type.
Open your scene in Unity (for example our Tanks demo), find the NetworkManager, find the Transport component, copy the Port into the plugin.
=> If you are using Kcp
then the Protocol Type is UDP
.
=> If you are using Telepathy
, then it's TCP
.
Almost done! Before we can Build and push, we need to install the Linux build support for Unity, and Docker!
In your Unity Hub, select Installs, press the Configuration icon next to your Unity version and click Add Modules:
Find and install Linux Dedicated Server Build. You may add the others too just to be safe:
Press Continue, wait, restart Unity once, done.
Edgegap works with containers, which means we need to install Docker. We don't need to worry about it ever, we just need to install it once.
Download it, install it, open it and leave it running. You can pretty much auto start it with your operating system each time.
Some users reported that they had to restart their computer once before they could use Docker. To be safe, consider restarting once!
Next, you need to log into yout docker registry. Open a Terminal / Console:
On Windows, hit CTRL+R, enter CMD, hit enter to open it.
On Mac, open Finder, go to Applications -> Utilities -> Terminal.
On Linux, you probably know how to do it.
Don't be scared of the Terminal. It's just black background and white text where we'll enter exactly one command. This will be automated soon.
You can find them under Credentials:
Now enter this simple terminal command. There won't be any others, promised!
Then enter your Username and Token (as password) that you see on the Edgegap.com -> Container Registry page.
If you can't seem to login, you can also try this command instead:
Docker Desktop remembers your login, so you won't have to do this again next time.
Alright, that's it for Docker.
Before we build the game server, select your NetworkManager
and make sure that Auto Start Server in Headless Mode is enabled. Otherwise the server application may launch but not call NetworkManager.StartServer(), so no one would be able to connect.
Next, press Build and Push in the Unity plugin:
You'll see a progress bar for a while:
Unity will create a Linux build, then create a Docker build, then upload the whole thing to Edgegap. Note that uploading will take a while depending on your internet connection. The progress bar halts while uploading, but you can check your operating system's bandwidth usage to see if it's still uploading:
If this all worked, then you'll see a log message:
If this failed, it'll show you errors. Here are a few common issues and workarounds:
Missing Linux Build Support: install it in your Unity hub. Make sure you do it for the Unity version that you are using in your project. This generally works once you have the Linux Build Support installed.
Incremental Build Failed: delete your previous Unity Linux build in the /Builds folder next to the /Assets folder, restart Unity try again. Delete your Library/ folder if you need to. This is a Unity bug that happens sometimes.
Docker authorization Failed: make sure Docker Desktop is running and make sure that you are logged in with the above Terminal command. Also make sure that image registry consists of the Container Registry's 'Project' + "/" + "your-game".
Now that we uploaded our server build to Edgegap, we need to Deploy (aka launch) it.
In the plugin, press Create New Deployment:
After a few seconds you'll see your running server in the list:
Note that our original port was 7777, but in the Deployment it says 30358. That's because one cloud server may launch multiple game servers. But there's only one port 7777, so it's using Port Mapping to find a free port for you.
Finally, press Play in the Unity Editor (or launch your client build).
Enter the deployment's hostname and port in the NetworkManager HUD:
Enter the hostname(fa\[...\].edgegap.net) and the port (30358) separately!
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 the Edgegap dashboard! 🤩
To reduce costs, you can press Stop Server in the plugin once you are done.
If you need to grab the server status from the above screenshot from your Game, you can use:
If your Server Status says Ready but you can't seem to connect, try this:
On the Edgegap Dashboard, go to Deployments -> select your Deployment -> select Container Logs, check the log files to see if your game server actually 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.
Huge thanks to the Mirror team! Their support has been stellar and we're amped to offer you a combined service that packs a serious punch. With Mirror's collaboration, we're able to hook you up with 1.5 vCPU for free! Stay tuned for more awesomeness ahead.
Please refer to on installation.
This plugin does not need to be included in your builds, as it's only a development tool and does not have any runtime features. If you wish to inspect our implementation, the . You may also review our.
The easiest way is to simply install .
Grab your Username + Token from the Container Registry page on the .
If you encounter other issues, report them on our channel. We want to find solutions for any possible issue and explain this here!
Press the Client button to connect to it, and now you are online!