Unity Services Server
Last updated
Last updated
Instead of using a dedicated game server, you can also use Unity Lobby + Unity Relay to connect your players, so that you don't need to host your own dedicated server, but they also don't need to change their firewall and router settings. This means the game server logic is executed by the host player instead or your own server, but the network messages are sent through a relay service to prevent firewall issues.
Link Unity Project
First you need 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 Lobby and Relay in the Multiplayer tab.
Change NetworkData in Resources/NetworkData Change lobby_type to Unity Services, and 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. (Because it would prevent you from connecting to the same game).
Open the network manager prefab, and under UnityTransport, change the Protocol to Relay
Now you should be able to test from the LobbyMenu scene. It if you have issues connecting, it may be because of version mismatch between Unity Engine, Netcode package, Lobby package and Relay package. Try updating Netcode, Lobby and Relay packages to latest or recommended version in the Package Manager.