Skip to main content
Multiplayer Servers platform provides a GSDK library that you can integrate into your Unity game server. The library is open source and can be found on the GSDK repository on GitHub.

Installation

You can copy the Assets/PlayFabSdk folder into your Unity project. After that, you need to enable the scripting directive ENABLE_PLAYFABSERVER_API on your Unity Build settings (example). Alternatively, you can use the provided Unity package file. You can find sample code in the MultiplayerServerSample project.

Usage

At a minimum, you need to implement PlayFabMultiplayerAgentAPI.Start() method and start a coroutine for the PlayFabMultiplayerAgentAPI.ReadyForPlayers() method, like in the code below
You would also want to register for when the game server becomes transitions to Active using the PlayFabMultiplayerAgentAPI.OnServerActiveCallback, like in the example below:
For more information regarding game server states, check Basics of a PlayFab game server section here
Moreover, you can implement the following callbacks on your game server:
  • PlayFabMultiplayerAgentAPI.OnMaintenanceCallback triggered when Azure needs to perform maintenance on the VM
  • PlayFabMultiplayerAgentAPI.OnShutDownCallback triggered when a termination notification is received
  • PlayFabMultiplayerAgentAPI.OnAgentErrorCallback triggered if there’s any error between game server and PlayFab VM Agent communication
For more GSDK samples, you can take a look at our MPS Samples repository here
Last modified on August 4, 2026