Okay first of all give you a brief introduction of the function i created:
its a function which checks wheather the net is working or not if net is working
it fetch the image and set image.sprite Or if it is not working then gives a debug.log(“Not working the net”);
So Here is the function :
public void LoadImage()
{
StartCoroutine(CheckInternet());
//Call the actual loading method
if (isInternet == false)
{
StartCoroutine(RealLoadImage());
}
else
{
Debug.Log("No InternetConnection is Enable");
}
}
On Button Click Event this function is executed.
Here is the function which checks the internet
IEnumerator CheckInternet()
{
WWW internet = new WWW("www.google.com");
yield return internet;
if (internet.error != null)
{
isInternet = false;
}
else
{
isInternet = true;
}
yield return null;
}
It check the light page forexample : google.com
if it returns the google.com it means net is working
but for my scenerio in function
CheckInternet()
WWW internet = new WWW(“www.google.com”);
yield return internet;
it exits from here yield statement but it should countinue to next statement to make isInternet false or true.
Thanks in advance