Question by
kordou · Mar 29, 2018 at 06:05 AM ·
wwwyieldienumeratorstartcoroutine
wait WWW to finish download with yield does not work
HI, i need some help please here, I have a simple code like that
String mywebtext;
string mylink = "my link of the file goes here" ;
public void readdatafromweb()
{
StartCoroutine (readthefile (mylink));
// and then call a function that manipulates mywebtext to split it with some chars,
}
IEnumerator readthefile (string url)
{
WWW MyTXT= new WWW (url);
yield return MyTXT;
mywebtext = MyTXT.text;
}
my problem is that even i have a yield return the code proceed to the next funtion before the download is finished and the 'mywebtext' gets a value so i get an error or www not finished
i also tried
yield return new waitUntil(()=> MyTXT.isdone == true); // but also the same issue
can someone tell how can i proceed when and only the mywebtext gets the text of the link;
thanks in advanced
Comment