- Home /
Am i using the ping class right?
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<int> pingList;
void Start ()
{
pingList = new List<int> ();
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.
Comment
Your answer
Follow this Question
Related Questions
how can i get my ping? 2 Answers
Arc Movement Lerp, Mathf.Sin and Mathf.Pingpong question 1 Answer
Unity Maximize lag 0 Answers
Detecting internet availability on Android 7 Answers
Very Low fps. 0 Answers