# Unity Services Server

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 Project to Unity Services

**Link Unity Project**&#x20;

First you need to link your project to Unity Services inside Project Settings-Services

**Enable Relay**&#x20;

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 Settings in your Project

Change **NetworkData** in Resources/NetworkData Change lobby\_type to Unity Services, and change lobby\_game\_type to RelayServer.  Change auth\_type to Unity.&#x20;

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).

<div align="left"><figure><img src="/files/CrmVARzP7AlP9fGgeXOd" alt="" width="318"><figcaption></figcaption></figure></div>

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

![](/files/JzYMZaNqipwsBTvTFgYM)

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.

\
In the newest Unity Versions, Relay and Lobby packages have been replaced by Multiplayer Services, if you get a warning on those packages. You can simply remove Lobby and Relay and instead install Multiplayer Services, it will work since it's just a rename and merge of the same packages.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://indiemarc.gitbook.io/netcodeplus/getting-started/unity-services-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
