Relay Server

Instead of using a dedicated game server, you can also use Unity Relay to connect people in Peer-to-peer but with a relay, so that they don't need to change their firewall and router settings.

The lobby server will still be dedicated, since a central server is needed to share the relay information before players connects, but once a game start in relay mode, the game server logic would be executed by the host player instead or your own server.

Here are the steps to install Unity relay, once you are finished, see the Lobby tab to also install your dedicated lobby.

Link Unity Project First make sure to link your project to Unity Services inside Project Settings-Services

Enable Relay Go on the Unity Dashboard https://dashboard.unity3d.com/ Make sure you select the project you linked to. And enable relay in the Multiplayer tab.

Change NetworkData in Resources/NetworkData Change lobby_game_type to RelayServer Change auth_type to Unity. Use auth_auto_logout when testing 2 instances on the same pc so that it doesn't use the same UserID twice.

Change NetworkManager prefab Open the network manager prefab, and under UnityTransport, change the Protocol to Relay

To test you will need to run the lobby, either make a build with lobby_url to 127.0.0.1 and run it locally with 2 game client windows, or set the lobby_url to your server and host your lobby on a server (see Cloud Server Installation).

Last updated