Documentation

​
​

Development

User Acquisition

Monetization

Industry

Multiplayer Services SDK

All Services

Multiplayer Services SDK

Multiplayer
​
​
Multiplayer Services SDK
  • Overview
  • Get started
  • Use multiplayer sessions
    • Integrate Multiplayer sessions
    • Game server hosting support
  • Manage sessions
  • Connect players through a relay
  • Networking
  • Matchmaking
  • Monitor and debug sessions
  • Tutorials
  • Reference
  1. Multiplayer Services SDK

Game server hosting support

Integrate different hosting solutions using Cloud Code modules to manage servers.
Read time 2 minutes
Last updated 4 days ago

Multiplayer Services are compatible with many game server hosting providers to provide advanced multiplayer features. In combination with Cloud Code modules, you can allocate servers, create multiplayer sessions, and enable player backfilling.

Hosting with Cloud code modules

The matchmaker services within the Multiplayer Services SDK can use Cloud Code modules to allocate game servers and coordinate matchmaking results.
Refer to the documentation on Hosting with Cloud Code modules for further details.

Authentication

You must authenticate the server with a service account using
ServerAuthenticationService.Instance.SignInWithServiceAccountAsync
. Refer to Create a service account.

Backfilling

If Matchmaker allocated the server, it's possible to automatically request new players to join to backfill empty slots. These empty slots could be due to players leaving the session or because Matchmaker quickly created the match to minimize matchmaking time:
// Adapt session options to your game needs var sessionOptions = new SessionOptions(){ MaxPlayers = 2};// Add backfilling configuration if you want the session to automatically set up backfill when a player leaves.// This requires having the "Matchmaker Backfill Admin" permission on your service account.sessionOptions.WithBackfillingConfiguration( enable: true, automaticallyRemovePlayers: true, autoStart: true, playerConnectionTimeout: 30, backfillingLoopInterval: 1);
This code can start the backfilling process as soon as the session is created. Additionally, this code automatically starts the backfilling process when the session has one more empty slot.
Backfilling requires having the "Matchmaker Backfill Admin" permission on your service account. Refer to Matchmaker Backfill Admin for the required Matchmaker backfill API permission.
Note
MaxPlayers
in the session options must be equal to or higher than the maximum players set in the matchmaking configuration.
It's also possible to manually start and stop the backfilling process using the following code:
IServerSession session = await MultiplayerServerService.Instance.CreateMatchSessionAsync(matchId, sessionOptions);// Start the backfilling if it is not already in progressawait session.StartBackfillingAsync();/// Stop the backfillingawait session.StopBackfillingAsync();
Starting and stopping the backfilling of a session can be useful if certain times aren't appropriate for players to be joining (for example, if the session is about to end, or if a cinematic is in progress).
Refer to WithBackfillingConfiguration() for more information on the backfilling configuration.

Additional resources

  • WithBackfillingConfiguration()
  • Backfill (Matchmaker)
  • Matchmaker Backfill Admin

Copyright © 2026 Unity Technologies
LegalPrivacy PolicyCookiesDocumentation Terms of UseDo Not Sell or Share My Personal InformationYour Privacy Choices (Cookie Settings)

"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S and elsewhere (more info here). Other names or brands are trademarks of their respective owners.

Some pages are machine-translated for convenience, and may contain inaccuracies. In the event of conflicting information, the English version is authoritative.

  • On this page
    • Hosting with Cloud code modules

    • Authentication

    • Backfilling

    • Additional resources


Report a problem with this page