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 XelareipOB · Feb 24, 2016 at 07:09 PM · unityeditorwebonline

UnityWebRequest isDone crash

Hi guys,

I recently tried to adapt part of our web requests to use UnityWebRequests throughout our project and came across a weird issue.

Part of the code was yielding the result and worked just fine but I tried to use the isDone and downloadProgress properties to report progress and got a 100% editor crash when doing so.

Here is the old working code :

 using (UnityWebRequest request = new UnityWebRequest(Url, Method))
 {
     var it = headers.GetEnumerator();
     while (it.MoveNext())
     {
         var entry = it.Current;
         request.SetRequestHeader(entry.Key, entry.Value);
     }
     if (body != null)
     {
         UploadHandler upload = new UploadHandlerRaw(body);
         request.uploadHandler = upload;
     }
     DownloadHandler download = new DownloadHandlerBuffer();
     request.downloadHandler = download;
     yield return request.Send();
     response = new WebRequestResponse(request);
 }


Here's the code that creates a crash of the editor :

 using (UnityWebRequest request = new UnityWebRequest(Url, Method))
 {
     var it = headers.GetEnumerator();
     while (it.MoveNext())
     {
         var entry = it.Current;
         request.SetRequestHeader(entry.Key, entry.Value);
     }
     if (body != null)
     {
         UploadHandler upload = new UploadHandlerRaw(body);
         request.uploadHandler = upload;
     }
     DownloadHandler download = new DownloadHandlerBuffer();
     request.downloadHandler = download;
     request.Send();
     while (request.isDone == false)
     {
         Progress = request.downloadProgress;
         yield return null;
     }
     response = new WebRequestResponse(request);
 }

And most surprising of all to me is that we found a workaround doing this :

 using (UnityWebRequest request = new UnityWebRequest(Url, Method))
 {
     var it = headers.GetEnumerator();
     while (it.MoveNext())
     {
         var entry = it.Current;
         request.SetRequestHeader(entry.Key, entry.Value);
     }
     if (body != null)
     {
         UploadHandler upload = new UploadHandlerRaw(body);
         request.uploadHandler = upload;
     }
     DownloadHandler download = new DownloadHandlerBuffer();
     request.downloadHandler = download;
     AsyncOperation op = request.Send();
     while (op.isDone == false)
     {
         Progress = op.progress;
         yield return null;
     }
     response = new WebRequestResponse(request);
 }

(Not sure the isDone and progress properties are good in this case though) It does look like a bug in the editor to me, does any of you have more info on that or should I report a bug?

I'm working on a simple repro case right now.

Thanks!

Edit : As expected I couldn't create a "simple" repro case as it's probably a mix of specific requests at various frequencies during gameplay. Still, the fact that the editor itself crashes is a problem that souldn't happen even if we have some scripting mistakes/bad practices

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

Answer by VickySmalley · Apr 28, 2017 at 11:17 AM

Hi,

I'm also using UnityWebRequests in the editor, and had the problem that I would never get a response using UnityWebRequest.isDone()

Other people seem to also have problems with it, albeit slightly different.

http://answers.unity3d.com/questions/1260447/unitywebrequest-timing-out-send-finishes-but-isdon.html https://issuetracker.unity3d.com/issues/unitywebrequest-dot-isdone-is-always-false-when-it-is-trying-to-communicate-with-a-nonexisting-remote-server

However, your workaround of assigning the result of UnityWebRequest.Send() to an AsyncOperation, then checking isDone() on that, also works for me - bizarre!

Comment
Add comment · 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
0

Answer by AjOverton · Feb 26, 2019 at 04:24 PM

checking either isDone in my Update() still crashed, but if I put an unholy Thread.Sleep(1) before I used the data I was ok.

Comment
Add comment · 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

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

how to host unity web build online ?? error to download data 2 Answers

Issue with offline web player forcing update and not playing .unity3d file if unable to connect to unity3d update site 3 Answers

How to open a Webgl unity game from a different html page? 1 Answer

Getting it to the web 1 Answer

create a blog like application 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