Quantcast
Channel: Questions in topic: "ping"
Viewing all articles
Browse latest Browse all 93

Am i using the ping class right?

$
0
0
I am new to unity and i just want to make sure my code is working right(no hidden bug or anything like that) public class pingping : MonoBehaviour { Ping ping; List pingList; void Start () { pingList = new List (); StartCoroutine (PingUpdate()); } IEnumerator PingUpdate() { ping = new Ping ("216.52.241.254"); while (!ping.isDone) { yield return null; } pingList.Add (ping.time); Debug.Log (ping.time); yield return new WaitForSeconds (1f); StartCoroutine (PingUpdate ()); } } Code is just supposed to collect pings every 1-2 sec.

Viewing all articles
Browse latest Browse all 93

Trending Articles