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

Requirements

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

SettingDefaultWhat it does
connectionModePeer To PeerChooses 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:

  1. A Cloud Code script sends the match request.
  2. The game server listens for the request and starts a server instance, then return the server ip and port.
  3. Clients read those two values and connect.
Data visibility: set 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

SettingDefaultWhat it does
maxPlayerOnLobbyNMatch10Maximum players allowed in a lobby and in the match. Range is 2 to 100000.
showActiveLobbyListUIOnShows the list of active public lobbies.
showJoinLobbyByCodeUIOnShows an input field where players join a public or private lobby by typing its code.
canStartMatchWithNoMaxPlayerOnLobbyOffWhen 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 typePlayer list UIPlayers are
allIsEnemy1 column (Join)All opponents, one shared list
twoTeams2 columns, one per teamSplit 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.

SettingDefaultWhat it does
instantMatchmakingOffTurns instant matchmaking on.
instantMatchSearchTimeout10 secHow long to search for a matching lobby before the timeout behavior runs.
createFilteredLobbyOnInstantMatchMakingOnTimeoutOffOn: 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 typeFields shown
gameModeshowGameModeFilterUI, gameModeList
mapshowMapFilterUI, mapList
rankPoinshowRankPoinFilterUI, rankLabelUIList
regionlobbyUseBestRegion, 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:

FlagEffect
addDirectlyToTheCreateLobbyActiveFilterListThe entry is applied automatically when creating a lobby.
addDirectlyToTheFindLobbyActiveFilterListThe entry is applied automatically when searching for a lobby.
ListEntry fields (besides the two flags)
gameModeListfilterCodeName (string), lobbyType: allIsEnemy or twoTeams
mapListfilterCodeName (string)
regionListregion (bestRegion, NA, EU, APAC, LATAM regions, MiddleEast, SouthAfrica)
rankLabelUIListrankLabelName, 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.

SettingDefaultWhat it does
showCustomLobbyDataFilterUIOffShows the custom key and value filter UI, so the player can pick.
customLobbyFilterListEmptyThe custom key and value filters. Each entry is a CustomLobbyDataFilter.

CustomLobbyDataFilter

FieldWhat it does
lobbyDataKeyKey name in the custom lobby data dictionary.
visibilityLobby data visibility: Public, Member, or Private.
addFilterInListUIAdds this filter to the custom data list UI for the player to pick.
lobbyDataValueOptionListThe option values for this key. Each entry is a CustomLobbyDataValueFilter.

CustomLobbyDataValueFilter

FieldWhat it does
valueNameA value stored under the key.
addDirectlyToTheCreateLobbyActiveFilterListApplied automatically when creating a lobby.
addDirectlyToTheFindLobbyActiveFilterListApplied 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;
}
Visibility: filter on keys set to Public. Lobby searches only see public data, and Member data is visible only to players already in the lobby.

Reading values in code

SettingPropertyChange event
connectionMode_connectionModeOnListenServerValChange
maxPlayerOnLobbyNMatchMaxPlayerOnLobbyNMatchOnMaxPlayerOnLobbyNMatchLastValValChange
showActiveLobbyListUIShowActiveLobbyListUIOnShowActiveLobbyListUIValChange
showJoinLobbyByCodeUIShowJoinLobbyByCodeUIOnShowJoinLobbyByCodeUI
canStartMatchWithNoMaxPlayerOnLobbyCanStartMatchWithNoMaxPlayerOnLobbyOnCanStartMatchWithNoMaxPlayerOnLobbyValChange
instantMatchmakingInstantMatchmakingOnInstantMatchmakingValChange
instantMatchSearchTimeoutInstantMatchSearchTimeoutnone
createFilteredLobby…OnTimeoutCreateFilteredLobbyOnInstantMatchMakingTimeoutOnCreateFilteredLobbyOnInstantMatchMakingOnTimeoutValChanged
preMadeKeyLobbyFilterListPreMadeKeyLobbyFilterListnone
showCustomLobbyDataFilterUIShowCustomLobbyDataFilterUIOnShowCustomLobbyDataFilterUILastValChanged
customLobbyFilterListCustomLobbyFilterListnone
var settings = SettingManager.instance;

if (settings.InstantMatchmaking)
    StartInstantSearch(settings.InstantMatchSearchTimeout);

settings.OnShowActiveLobbyListUIValChange += show => lobbyListPanel.SetActive(show);

Notes

Best region: when lobbyUseBestRegion is on, the lobby uses the region closest to the player. The region list below it is ignored and its UI is hidden.
Rank points: keep 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.