IEnumerator DoPingAsync() { // How long to run the ping var pingSeconds = m_HeadlessRunTimeMs / 1000f; Debug.Log($"Pinging remote server for {pingSeconds} seconds..."); // Start new ping client var udpPinger = new UdpPingWrapper(); var timer = Stopwatch.StartNew(); try { udpPinger.Start(m_CustomIp); while (timer.ElapsedMilliseconds < m_HeadlessRunTimeMs) { udpPinger.Update(); yield return(null); } // Dump ping stats before we dispose of the client Debug.Log(udpPinger.GetStats()); } finally { udpPinger.Dispose(); } }
// Update is called once per frame void Update() { m_UdpPing?.Update(); }