void Start() { GameserverSDK.RegisterShutdownCallback(OnShutdown); } public override void OnServerDisconnect(NetworkConnection conn) { base.OnServerDisconnect(conn); players.Remove(players.Find(i => i.PlayerId == conn.connectionId.ToString())); GameserverSDK.UpdateConnectedPlayers(players); if (numPlayers <= 0) shutDownCoroutine = StartCoroutine(ShutDownCo()); } protected virtual IEnumerator ShutDownCo() { yield return new WaitForSeconds(secondsToShutdown); var request = new ShutdownMultiplayerServerRequest() { BuildId = GameserverSDK.getConfigSettings()[GameserverSDK.BuildIdKey], Region = (AzureRegion)Enum.Parse(typeof(AzureRegion), GameserverSDK.getConfigSettings()[GameserverSDK.RegionKey]), SessionId = GameserverSDK.getConfigSettings()[GameserverSDK.SessionIdKey] }; PlayFabMultiplayerAPI.ShutdownMultiplayerServer(request, OnShutdownResponse, OnPlayFabError); } void OnShutdown() { LogMessage("Shutting down..."); NetworkManager.singleton.StopServer(); Application.Quit(); //_listener.Close(); }
Am I supposed to make the call to shut down the server as shown above, or does ThunderHead do it automatically when the GameserverSDK.UpdateConnectedPlayers(players) is 0? All of the above logic is within the Game Server that is running on ThunderHead. This is in Unity using the PlayFabSDK and GameServerSDK.