void UpdateForGUI()
 {
     m_PingClient?.RunPingGenerator();
 }
        void UpdateForHeadless()
        {
            // Don't do anything if we're waiting for matchmaking
            if (m_Matchmaker != null)
            {
                return;
            }

            // Start matchmaking if it was requested via command-line flags
            if (m_HeadlessShouldMatchmake)
            {
                StartNewMatchmakingRequest();
                return;
            }

            // By the time we get to here, MM has already succeeded or failed or we never needed to start it
            if (m_LastMatchmakingState == Matchmaker.MatchmakingState.Error)
            {
                Debug.Log("Matchmaking failed, aborting headless run and shutting down ping client.");
                EndProgram(1);
            }

            // Start ping client if we need to start it
            if (m_PingClient == null)
            {
                if (m_HeadlessShouldPingServer)
                {
                    StartNewPingClient();
                    var pingSeconds = m_HeadlessRunTimeMs / 1000f;
                    Debug.Log($"Pinging remote server for {pingSeconds} seconds...");
                    m_PingUntil = Time.fixedUnscaledTime + pingSeconds;
                }
                else if (m_HeadlessShouldTerminateServer)
                {
                    TerminateRemoteServer();
                    EndProgram(0);
                }
            }
            else
            {
                // Keep pinging until we run out of time
                if (Time.fixedUnscaledTime < m_PingUntil)
                {
                    m_PingClient.RunPingGenerator();
                }
                else
                {
                    // Dump stats before we dispose of the client
                    Debug.Log($"STATS: Pings sent: {m_Stats.TotalPings}" +
                              $"\nSTATS: Last ping: {m_Stats.LastPing}" +
                              $"\nSTATS: Total Average ping: {m_Stats.TotalAverage}" +
                              $"\nSTATS: Average of last 50 pings: {m_Stats.GetRollingAverage()}" +
                              $"\nSTATS: Pings per second: {m_Stats.PingsPerSecond()}");

                    if (m_HeadlessShouldTerminateServer)
                    {
                        TerminateRemoteServer();
                    }

                    Debug.Log("Finished headless mode tasks, shutting down...");

                    EndProgram(0);
                }
            }
        }