using System.Collections; using System.Collections.Generic; using UnityEngine; using PlayFab; using PlayFab.MultiplayerAgent.Model; using PlayFab.Internal; using PlayFab.ServerModels; public class HelloWorldServer : MonoBehaviour { float timer; bool timerActive; int count; void Start() { PlayFabMultiplayerAgentAPI.Start(); PlayFabMultiplayerAgentAPI.OnShutDownCallback += OnShutdown; PlayFabMultiplayerAgentAPI.ReadyForPlayers(); timer = 5; timerActive = true; } void Update() { if (timerActive) { if (timer < .01f) { Debug.LogWarning("******************************** Hello World " + (++count) + " **************************************"); timer = 5; } else timer -= Time.deltaTime; } } void OnShutdown() { Debug.LogWarning("Server is shutting down"); StartCoroutine(Shutdown()); } IEnumerator Shutdown() { yield return new WaitForSeconds(.5f); Application.Quit(); } }