I’m currently creating a server browser in my game that includes a ping column. I’m getting the ping using something like this:
Ping myPing = new Ping(myMatchIpAddress);
while (!myPing.isDone)
yield return null;
Debug.Log("Ping: " + myPing.time);
The problem: This is only working on about 25% of the games that are being played right now. The others never return a value.
myMatchIpAddress is being obtained from the game lobby’s data, and was originally found on the server’s end using something like this:
Network.Connect("http://www.google.com");
while (Network.player.externalIP == "" || Network.player.externalIP == "UNASSIGNED_SYSTEM_ADDRESS")
yield return null;
Network.Disconnect();
Debug.Log("External IP: " + Network.player.externalIP);
This seems to be getting the server’s external IP address fine.
Any ideas on why there seems to be such an issue pinging such a large number of these IP addresses? Am I going about this wrong in some way?