C# function that loads WWW?

Transitioning a script heavy with WWW’s from JS to C# … it looks like the usual void does not seem to work even if there is no return type with C# function that makes a WWW? How do you declare a C# function that makes a WWW call?

You need to declare such a function as a coroutine and call it with the StartCoroutine method, or it will not work. Do not use void.

void CallingFunction()
{
   string url = "http://blah.com/sample"
   StartCoroutine("RequestWWW", url);
}

IEnumerator RequestWWW(string url)
{
   WWW www = new WWW(url);
   yield return www;
   //Now call what you wish once the request returns response
}