private void Start() { StartCoroutine(Simulation()); Debug.LogFormat("Server status: {0}", server.Status); _lastStatus = server.Status; }
private void Update() { if (_lastStatus != server.Status) { Debug.LogFormat("Server status: {0}", server.Status); _lastStatus = server.Status; } }
private void Update() { // If the status has changed, log it and save the new one. if (_lastStatus != server.Status) { LogWithTimestamp(string.Format("Server status: {0}", server.Status)); _lastStatus = server.Status; } }
private void Start() { // Start simulating game server behavior. // Here all the calls to the SDK are done within a coroutine just to give a clear example in one place. // In a real project, these calls can be done from any suitable place, including Update. StartCoroutine(Simulation()); LogWithTimestamp(string.Format("Server status: {0}", server.Status)); // Initialize the cached status of the server to check if it needs to be logged later. _lastStatus = server.Status; }