using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class BackgrountConnHandler : MonoBehaviour {
public string Back;
IEnumerator checkInternetConnection(Action<bool> action){
WWW www = new WWW("http://google.com");
yield return www;
yield return new WaitForSeconds (2);
if (www.error != null) {
action (false);
Debug.Log ("Error");
yield return new WaitForSeconds (3);
SceneManager.LoadScene (Back);
} else{
Debug.Log ("Success");
}
}
void Start(){
StartCoroutine(checkInternetConnection((isConnected)=>{
// handle connection status here
}));
}
}
I have the above script. I want when it checks for the Internet connection and comes to else that means i have internet connection to check again and againt for ever. Sorry for my bad english.