- Home /
Method returning data from WWW
Hello, I'm trying to create a simple DataManager with a method that can, when called, return the data collected from a PHP page via the WWW class. I'm a bit stuck on how to do this. Is there any other way to get a method to wait for the WWW's response other than a coroutine or how do I work with the coroutine to eventually create the method to return the result from the WWW?
Thanks
Comment
Best Answer
Answer by Waz · Aug 30, 2011 at 11:15 AM
No. Can you imagine a web browser that completely froze waiting for a page to download?
The best you can do is to use the same yielding technique that Unity does. I.e. this pattern:
yield getter.EnsureDataReady();
UseData(getter.data);
Blocking IO died with DOS. (well, it didn't but it should have...)