I need to load a random number of textures at runtime. They may or may not exist at the given URL, if the server is even up. Some of them might be local ("file:///...."). Eventually, I need to know when to give up looking for them.
Does the WWW object have a way of doing this? The .error member? Syntax?
asked Jan 31 '11 at 04:16 AM
Yep, the .error property is exactly what you want
answered Jan 31 '11 at 04:31 AM
If I can follow up on this, it seems like the 404 error is actually not in the error attribute, but in the text attribute... I've had no problems with actually getting the WWW code to download my files and accessing my data, but when testing rainy day scenarios, such as file not existing, etc, the isDone property seems successfully set to true, but the error property is null... after spending some time stripping down my code to the simple use of WWW on its own, I found the actual 404 not found error string was in the text property. I noticed another post on here that someone had the same problem... is this a known issue with a potential resolution, otherwise what's a good simple way to detect this error, as the .NET XML parser seems to throw an exception when trying to parse this information. If anyone would like more information, I can post it...
Here is what I'm seeing in my Unity Web Log:
from accessing WWW.text's property.