Multiplayer Lobby & Matchmaking Kit
Add sign-in, cloud save, player profiles, and lobby matchmaking to your Netcode for GameObjects game. Configure everything from one asset.
What you get
Sign in
Players sign in with a Unity Player Account or start right away as a guest. Built on Unity Authentication.
Cloud save
Player data is stored with Unity Cloud Save instead of only on the device.
Player profile
Players can set and change their display name. Name change is the only profile option.
Lobbies and matchmaking
- Host as peer to peer, or use a dedicated server.
- Public lobby list, plus join by code for public or private lobbies.
- Instant matchmaking with a search timeout and a choice of fallback.
- Lobby filters for game mode, map, rank points, and region, including closest region.
- Custom lobby data filters with your own keys and values.
- An optional start before the lobby is full.
- Every option lives in one ScriptableObject, with change events your UI can listen to.
Requirements
- Netcode for GameObjects
- Unity Authentication
- Unity Cloud Save
- A Unity Gaming Services project linked to your Unity project
Setup and settings
Edit the settings in the Inspector on the SettingManager asset. The asset must sit in a Resources folder and be named SettingManager, because the static instance loads it with Resources.Load. In the Editor, if it’s missing, a warning is logged and the asset is created for you at Assets/Resources/SettingManager.asset. In a build the asset must already exist, otherwise instance is null.
Every setting is private and read through a public property. Most settings also raise a change event when you edit them in the Inspector during Play mode, so UI and networking code can react without polling.
Multiplayer connection
| Setting | Default | What it does |
|---|---|---|
connectionMode | Peer To Peer | Chooses the connection mode (peerToPeer or dedicatedServer). Peer To Peer: one player hosts and also plays. Dedicated Server: a standalone server hosts the match. |
Dedicated server: requesting a match
With Dedicated Server, the match runs on a separate game server instead of a player’s device. We recommend using a Cloud Code script to send the match request:
- A Cloud Code script sends the match request.
- The game server listens for the request and starts a server instance, then return the server ip and port.
- Clients read those two values and connect.
KEY_SERVER_IP and KEY_SERVER_PORT to Member or Public so clients can read them. Data marked Private is visible only to the lobby host.Lobby settings
| Setting | Default | What it does |
|---|---|---|
maxPlayerOnLobbyNMatch | 10 | Maximum players allowed in a lobby and in the match. Range is 2 to 100000. |
showActiveLobbyListUI | On | Shows the list of active public lobbies. |
showJoinLobbyByCodeUI | On | Shows an input field where players join a public or private lobby by typing its code. |
canStartMatchWithNoMaxPlayerOnLobby | Off | When on, the host can start the match before the lobby is full. |
Game mode lobby types
Each gameModeList entry has a lobbyType. It decides how the player list is laid out inside the lobby.
allIsEnemy
Free for all. Every player joins the same group, so the lobby shows a single Join column with one list of players. There are no teams, and everyone is an opponent of everyone else.
twoTeams
Two teams face each other. The player list UI is split into two columns, one for each team. Players join the column of the team they want to play on.
| Lobby type | Player list UI | Players are |
|---|---|---|
| allIsEnemy | 1 column (Join) | All opponents, one shared list |
| twoTeams | 2 columns, one per team | Split into Team 1 and Team 2 |
Instant matchmaking (no lobby UI)
Skips the lobby browser and matches the player as soon as they press play. The lobby UI toggles above aren’t used in this mode.
| Setting | Default | What it does |
|---|---|---|
instantMatchmaking | Off | Turns instant matchmaking on. |
instantMatchSearchTimeout | 10 sec | How long to search for a matching lobby before the timeout behavior runs. |
createFilteredLobbyOnInstantMatchMakingOnTimeout | Off | On: create a new lobby using the selected filters. Off: join any open lobby, or create one if none exist. |
Lobby filters
The preMadeKeyLobbyFilterList holds one entry per built-in filter. Each entry has a lobbyFilter type, and the Inspector only shows the fields for that type.
| Filter type | Fields shown |
|---|---|
| gameMode | showGameModeFilterUI, gameModeList |
| map | showMapFilterUI, mapList |
| rankPoin | showRankPoinFilterUI, rankLabelUIList |
| region | lobbyUseBestRegion, showRegionFilterUI, regionList |
Custom key and value filters are not a filter type. They have their own list, described below.
Filter entries
Every entry in a list has two flags that add it to the automatic search without the player choosing it:
| Flag | Effect |
|---|---|
addDirectlyToTheCreateLobbyActiveFilterList | The entry is applied automatically when creating a lobby. |
addDirectlyToTheFindLobbyActiveFilterList | The entry is applied automatically when searching for a lobby. |
| List | Entry fields (besides the two flags) |
|---|---|
gameModeList | filterCodeName (string), lobbyType: allIsEnemy or twoTeams |
mapList | filterCodeName (string) |
regionList | region (bestRegion, NA, EU, APAC, LATAM regions, MiddleEast, SouthAfrica) |
rankLabelUIList | rankLabelName, minRankRangePoin, maxRankRangePoin. The list is also used for rank system labeling. |
Custom lobby data filter
Add your own key and values to the lobby data. It lets you filter lobbies by anything the built-in filters don’t cover. These live in customLobbyFilterList, separate from preMadeKeyLobbyFilterList.
| Setting | Default | What it does |
|---|---|---|
showCustomLobbyDataFilterUI | Off | Shows the custom key and value filter UI, so the player can pick. |
customLobbyFilterList | Empty | The custom key and value filters. Each entry is a CustomLobbyDataFilter. |
CustomLobbyDataFilter
| Field | What it does |
|---|---|
lobbyDataKey | Key name in the custom lobby data dictionary. |
visibility | Lobby data visibility: Public, Member, or Private. |
addFilterInListUI | Adds this filter to the custom data list UI for the player to pick. |
lobbyDataValueOptionList | The option values for this key. Each entry is a CustomLobbyDataValueFilter. |
CustomLobbyDataValueFilter
| Field | What it does |
|---|---|
valueName | A value stored under the key. |
addDirectlyToTheCreateLobbyActiveFilterList | Applied automatically when creating a lobby. |
addDirectlyToTheFindLobbyActiveFilterList | Applied automatically when searching for a lobby. |
If more than one value of the same key has a flag checked, the first one is picked.
public struct CustomLobbyDataFilter
{
public string lobbyDataKey;
public DataObject.VisibilityOptions visibility;
public bool addFilterInListUI;
public List<CustomLobbyDataValueFilter> lobbyDataValueOptionList;
}
public struct CustomLobbyDataValueFilter
{
public string valueName;
public bool addDirectlyToTheCreateLobbyActiveFilterList;
public bool addDirectlyToTheFindLobbyActiveFilterList;
}
Public. Lobby searches only see public data, and Member data is visible only to players already in the lobby.Reading values in code
| Setting | Property | Change event |
|---|---|---|
| connectionMode | _connectionMode | OnListenServerValChange |
| maxPlayerOnLobbyNMatch | MaxPlayerOnLobbyNMatch | OnMaxPlayerOnLobbyNMatchLastValValChange |
| showActiveLobbyListUI | ShowActiveLobbyListUI | OnShowActiveLobbyListUIValChange |
| showJoinLobbyByCodeUI | ShowJoinLobbyByCodeUI | OnShowJoinLobbyByCodeUI |
| canStartMatchWithNoMaxPlayerOnLobby | CanStartMatchWithNoMaxPlayerOnLobby | OnCanStartMatchWithNoMaxPlayerOnLobbyValChange |
| instantMatchmaking | InstantMatchmaking | OnInstantMatchmakingValChange |
| instantMatchSearchTimeout | InstantMatchSearchTimeout | none |
| createFilteredLobby…OnTimeout | CreateFilteredLobbyOnInstantMatchMakingTimeout | OnCreateFilteredLobbyOnInstantMatchMakingOnTimeoutValChanged |
| preMadeKeyLobbyFilterList | PreMadeKeyLobbyFilterList | none |
| showCustomLobbyDataFilterUI | ShowCustomLobbyDataFilterUI | OnShowCustomLobbyDataFilterUILastValChanged |
| customLobbyFilterList | CustomLobbyFilterList | none |
var settings = SettingManager.instance;
if (settings.InstantMatchmaking)
StartInstantSearch(settings.InstantMatchSearchTimeout);
settings.OnShowActiveLobbyListUIValChange += show => lobbyListPanel.SetActive(show);
Notes
lobbyUseBestRegion is on, the lobby uses the region closest to the player. The region list below it is ignored and its UI is hidden.minRankRangePoin lower than maxRankRangePoin for each rank range in rankLabelUIList.The Inspector shows only the fields that apply to the selected filter type, so an empty-looking entry usually means its type is set to something else.