Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Eidern · Aug 19, 2017 at 09:17 AM · wwwbug-perhapswww class

Unity 2017 www bug?

Hello, I'm just wondering if the WWW class got some trouble with the error handlings right now? I've got a little snippet that works under Unity 5, but as soon as I test it under unity 2017 I get errors.

  Enumerator Start () {
         //Creating user table
         string createJsonLink = "my url wich contains a php file that create a json file";
         yield return StartCoroutine(loadingTable(createJsonLink));
     }
 
 IEnumerator loadingTable(string createLink){
         print("create link:"+createLink);
         check = false;
         www = new WWW(createLink);
         //Load the data and yield (wait) till it's ready before we continue executing the rest of this method.
         yield return www;
 
         if (!string.IsNullOrEmpty(www.error))
         {
             //Sucessfully loaded  and executed the php file
             print("loaded OK");
         }
         else
         {
             Debug.Log("ERROR: " + www.error);
         }
 
     }

this outputs :

create link:the url link correctly passed

ERROR:

As if there was no returned message or anything. I've see that some people got similar trouble and changed the usual if (www.error == null) by if (!string.IsNullOrEmpty(www.error)) which i did too, but without success.

Does some other people get this problem too ?

Comment
Add comment · Show 8
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 BigToe · Aug 22, 2017 at 10:13 PM 0
Share

I am having the same issue. Worked in 5.6, but not in 2017. Don't have an answer yet, but just wanted to let you know you aren't crazy.

avatar image Eidern · Aug 23, 2017 at 02:45 PM 0
Share

thanks, I was starting to doubt of my mental health too :)

avatar image seb-kun · Aug 26, 2017 at 03:58 AM 0
Share

Hello,

I also have problems with WWW, I just switched to 2017 , and all my WWW are returning "$$anonymous$$ Error" now... and I am only accessing locals files :

 string url = "file:///" + folder_name + "/notes.mid";
 WWW midiFile = new WWW(url);
 
 while (!midiFile.isDone)
 {
 }
 
 if (!string.IsNullOrEmpty(midiFile.error))
 {
     GameController.Log("Can't Load Song: " + folder_name);
     return false;
 }
 

I am on Windows, it failed in Editor mode also. Regards, Seb

avatar image Bunny83 seb-kun · Aug 26, 2017 at 04:59 AM 0
Share

It's impossible that this has worked on any previous version of Unity. I work with Unity since version 2.6 and i can guarantee, nothing has changed in that regard.

Also using a while loop like this is dangerous and not recommended. It will completely fail on WebGL builds as they are "single threaded". So isDone has no chance to become true. Use a coroutine ins$$anonymous$$d.

btw. What you posted is not an answer to the question. I'll convert it into a comment.

avatar image Bunny83 · Aug 26, 2017 at 05:02 AM 0
Share

Can you please stop expecting bugs behind every problem? 99.9% of all problems we deal with here on UA are the reason of a "user error". And that's exactly the case here as well. -.-

avatar image Eidern Bunny83 · Aug 26, 2017 at 09:36 AM 0
Share

Well, I had this problem since the launch of Unity2017, post some questions about it -At start, I never think that it was a bug-, wanted to know what have changed since the 2017 launch , In my precedent version i just checked if there was a www.error (not a check on string), then after sawing some posts that telling that you have (since unity 2017) to check if the string message in the error was empty, I changed checking if the string was empty or not and Then I made the mistake of logic reverse :(

But as no one ever answer to it in month, just people complaining about the fact that since Unity2017 their code start to fails too, that's when I start doubting and wrote this question asking if it was a bug now.

Thanks anyway for pointing that out

avatar image Bunny83 Eidern · Aug 26, 2017 at 01:41 PM 1
Share

You don't have to check if there's an error, but if there's an error your code will break since you can't access www.text / www.texture / ... if there was an error. So it's common practise to check if the request was successful.

Nothing has changed in the WWW behaviour in the last 5 years or more. Where did you read that there was a change in 2017? Do you have a link?

Unfortunately there are quite a few people here on UA which base their answers soley on assumptions and personal opinion rather than empirical research and knowledge. I do make assumptions as well, but i always make clear that it is an assumption. Though i only make assumptions if i'm very sure that they are correct. If i do not know the answer i either test it myself before answering or just do not answer. It doesn't help anyone to spread wrong information.

Show more comments

1 Reply

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

Answer by Bunny83 · Aug 26, 2017 at 04:55 AM

Uhm you have reversed your logic. www.error will be null or empty when there is no error. Currently you check the opposite. You print error when the error message is null or empty. That's why the debug log shows, well, nothing. That's because everything just worked fine.

You have to use:

     if (string.IsNullOrEmpty(www.error))
     {
         //Sucessfully loaded  and executed the php file
         print("loaded OK");
     }
     else
     {
         Debug.Log("ERROR: " + www.error);
     }

Note that i removed the "not" from the if condition.

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 Eidern · Aug 28, 2017 at 06:53 AM 0
Share

stupid me :/

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

73 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

WWW.text length of a string in Unity3d populated ? 1 Answer

What has changed in the WWW class? What am I doing wrong? 0 Answers

Help searching google! 1 Answer

Downloading text from web gives html code. 2 Answers

Performance problem in web request upgrading from Unity 5.3.4f1 to Unity 5.6.4f1 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