Unity NGO
Explore how to host Unity projects on Edgegap using techniques from the NGO Boss Room Sample.
βοΈ Preparation
Before we start, you will need:
Unity 6 - download using Unity Hub,
Unity NGO [Netcode for Game Objects] Boss Room Sample project (modified for Edgegap):
β‘ Deploy and Connect
1. Deploy a Server on Edgegap
βοΈ To get started, you'll need to create a free account with Edgegap. No credit card required.
βοΈ Create a new app version for your application, choose NGO Boss Room Sample.
βοΈ Deploy a server with your NGO Boss Room Sample app version.
βοΈ Open your new deployment's details and find your unique, one-time connection details:
External Port in format
30854
(5 digits).
βοΈ Navigate to tab Logs and find (CTRL+F) your unique, one-time connection details:
ARBITRIUM_PUBLIC_IP
in format172.234.244.38
.
β You may now proceed to the next step.
2. Connect from Editor
βοΈ Open your new project in Unity.
βοΈ Press the βΆοΈ Play button to start your game client:
press START WITH DIRECT IP button,
select tab JOIN WITH IP.
βοΈ Input connection details from previous step.
βοΈ Press JOIN button to connect to your server.
βοΈ Connect a second virtual Player with Multiplayer Play Mode or ParrelSync.
π Congratulations on your first Deployment on Edgegap!
βοΈ Customize Server Build
See Getting Started - Servers for Unity to learn how to build and customize servers.
Run as Dedicated Server
For this sample to run as dedicated server, we made the following changes:
New script (added to your MainMenu
scene in a new empty GameObject
):
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.BossRoom.ConnectionManagement;
using UnityEngine;
namespace Unity.Multiplayer.Samples.BossRoom
{
public class EdgegapServerStarter : MonoBehaviour
{
public string portMapName = ;
// Start is called before the first frame update
void Start()
{
if (Application.isBatchMode)
{
ConnectionManager connectionManager = GameObject.Find("ConnectionManager").GetComponent<ConnectionManager>();
string internalPortAsStr = Environment.GetEnvironmentVariable($"ARBITRIUM_PORT_{portMapName.ToUpper()}_INTERNAL");
if (internalPortAsStr == null || !ushort.TryParse(internalPortAsStr, out ushort port))
{
throw new Exception($"Could not find port mapping, make sure your app version port name matches with \"{portMapName}\"");
}
connectionManager.StartHostIp("", "0.0.0.0", port);
}
}
}
}
Last updated
Was this helpful?