Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by DaveA · Jan 31, 2011 at 04:16 AM · texturewwwurltimeout

Best way to determine WWW timeout/404/etc.?

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?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Mike 3 · Jan 31, 2011 at 04:31 AM

Yep, the .error property is exactly what you want

if (www.error != null)
{
    //you couldn't download for some reason. www.error will be the string saying why
}
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DaveA · Jan 31, 2011 at 04:45 AM 0
Share

So, to be sure, in the cases I worry about, isDone will never be true, but eventually error will be non-null? Or would isDone go true with the error too?

avatar image Eric5h5 · Jan 31, 2011 at 05:19 AM 1
Share

@DaveA: isDone will be true when it's done, regardless of errors.

avatar image
1

Answer by cwodarcz · Feb 23, 2012 at 11:14 PM

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:

Success somehow...:

 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> 
     <html>
        <head> 
            <title>404 Not Found</title> 
        </head>
        <body> 
            <h1>Not Found</h1> 
            <p>The requested URL /sandboxes/applets/bootstrap/assetdownloads.xml was not found on this server.</p> 
        </body>
     </html>

from accessing WWW.text's property.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DaveA · Feb 29, 2012 at 01:09 AM 0
Share

I'd hate to have to write a 'screen scraper' to detect 404's in text, because some servers are configured to put up cutsy stuff. I would think the headers should contain the 404 status, and those are available, if poorly documented.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Load texture on disabled GameObject 1 Answer

loading different image links into a list 0 Answers

WWW.texture with a wildcard in the URL 1 Answer

How to assign texture from url 1 Answer

Screenshot PNG to GUITexture (NONE Texture) 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges