_EagleOwle_

InternetConnection

Feb 18th, 2020
83
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static IEnumerator InternetConnection(Action<bool> done, float waitTime = 2)
  2.     {
  3.         UnityWebRequest www = UnityWebRequest.Get("http://google.com");
  4.         yield return www;
  5.         yield return new WaitForSeconds(waitTime);
  6.         if (www.error != null)
  7.         {
  8.             done(false);
  9.         }
  10.         else
  11.         {
  12.             done(true);
  13.         }
  14.     }
RAW Paste Data