Advertisement
_EagleOwle_

InternetConnection

Feb 18th, 2020
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.38 KB | None | 0 0
  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.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement