I'm working on a game that uses the WWW class to push and pull data from our web server.
Right now the bulk of our web integration is using a WWW object with some WWWForm data passed in, and yielding to the www object. The only real error handling on our part is checking www.error.
My question is do we have to do anything else on top of that? Is there any built-in timeout errors that can happen if our server is hammered/slow? Are HTTP errors (403/404) handled properly? DNS errors?
While testing it, to my surprise in Unity Pro 2.6.1 a 404 Page not found is not seen as an error and gives error == null, and the resulting data the error page. At least domain not found is correctly handled by setting error string to message that it couldn't resolve the host.
Handling of timeout I didn't test but you could easily use an extra coroutine to handle the timeout situation yourself (using WWW is designed to be used in a coroutine where you yield until the data/error is available so your application should never block on it).
answered Dec 12 '09 at 01:52 AM