I am using pings in my game to determine if the user has an internet connection. However, they’re not working as expected. When I install my game on my phone and put my phone on airplane mode, the pings are still completing. Any ideas why this is happening? Am I using pings incorrectly? Here’s a shortened version of the logic I’m using.
public IEnumerator StartPing(string ip)
{
Ping p = new Ping(ip);
float startTime = Time.time;
while (!p.isDone && Time.time < startTime + 5.0f)
{
yield return new WaitForSeconds(0.1f);
}
if (p.isDone) //if the ping completed
{
Debug.Log("PING: successful");
}
else
{
Debug.Log("Ping: failed. IP:" + ip);
}
}