Migrate to the Multiplayer Services SDK
Transfer from the individual services' SDKs to the unified Multiplayer Services SDK.
Read time 3 minutesLast updated 12 hours ago
The Multiplayer Services SDK unites the functionality of the standalone SDKs from the following services: If you're already using any of the SDKs from these individual services in your project but want to move to the unified Multiplayer Services SDK, you must first migrate from the individual services' packages to the Multiplayer Services package.
Migrate from Lobby
To migrate from the Lobby SDK to the unified Multiplayer Services SDK, do the following:- Remove the Lobby package from the Package Manager.
- Install the Multiplayer Services package from the Package Manager.
- Change any usage of to
Lobbies.InstanceLobbyService.Instance
You have now migrated the functionality of the Lobby SDK to the Multiplayer Services SDK in your project.
Migrate from Matchmaker
To migrate from the Matchmaker SDK to the unified Multiplayer Services SDK, do the following:- Remove the Matchmaker package from the Package Manager.
- Install the Multiplayer Services package from the Package Manager.
You have now migrated the functionality of the Matchmaker SDK to the Multiplayer Services SDK in your project.
Migrate from Multiplay
Before you begin, you need to split your code between client-side, server-side, and shared code using one of the following methods:- Use the define symbol and encapsulate parts of your code in conditional compilation (marked by
UNITY_SERVER/#if). Refer to Conditional compilation in Unity (Unity documentation) for more details.#endif - Split the code into multiple assemblies using assembly definition files (Unity Manual), and only assign the platform to the server-side assembly definition.
Linux Dedicated Server
To migrate from the Multiplay SDK to the unified Multiplayer Services SDK, do the following:
- Remove the Multiplay package from the Package Manager.
- Install the Multiplayer Services package from the Package Manager.
- Update any assembly definition file referencing the Multiplay package to reference the Multiplayer Services package.
Migrate from Relay
To migrate from the Relay SDK to the unified Multiplayer Services SDK, do the following:- Remove the Relay package from the Package Manager.
- Install the Multiplayer Services package from the Package Manager.
- Change any usage of to
Relay.Instance.RelayService.Instance - Change constructors into
RelayServerData(hostAllocation, connectionType). Refer to the code below for more details.AllocationUtils.ToRelayServerData(hostAllocation, connectionType)
If you use Relay with the Unity Transport Protocol (UTP), adapt the creation of the
RelayServerDataFor the host
// maxConnections is the maximum number of connections the allocation is expecting// connectionType is the host connection type, this can be "dtls", "udp" or "wss"var allocation = await RelayService.Instance.CreateAllocationAsync(maxConnections);NetworkManager.Singleton.GetComponent<UnityTransport>().SetRelayServerData(AllocationUtils.ToRelayServerData(allocation, connectionType));
For the joining player
Refer to Use Relay with Netcode for GameObjects for more details on using Relay with Netcode for GameObjects with the Multiplayer Services SDK.// connectionType is the host connection type, this can be "dtls", "udp" or "wss"// joinCode is the allocation join code shared by the host player after creating the allocation and retrieving the join code var allocation = await RelayService.Instance.JoinAllocationAsync(joinCode); NetworkManager.Singleton.GetComponent<UnityTransport>().SetRelayServerData(new RelayServerData(allocation, connectionType));