When I run the following code the 1st after I start unity, it works fine and pulls down the expected json into downloadhandler.text.
If I either stop it from running in the editor or set isPlaying to false through the code, then run it a 2nd time without restarting unity, I get the error messages in the 2nd image.
If I restart unity, everything works fine.
In regards to unityWebRequest, is there something that I’m -not- doing correctly? Is there something I need to do when running multiple unityWebRequests? I’ve been googling this for a couple of days now and not seeing what I am doing wrong.
Thanks in advance for any help on this topic.
(If this is in the wrong forum, then please let me know what forum this should be in)
I also tried to put each unityWebRequest in it’s own IEnumerator and got the same results.
I see that you do something about cookies. In latest unity versions cookies do persist in the same session (until restart), maybe that’s the reason?
Same ‘session’. When you say session, do you mean the same unitywebrequest? Is it possible to re-issue a unitywebrequest?
I am running Unity 2019.2.6f1. I see a new version 2019.2.7f2 is available. I will download now and see if that changes anything.
BTW - thanks for the reply.
No, same session means same Unity run. So for second request Unity should automatically send cookie.
These kinds of errors are best to check using some HTTP debugging proxy like Fiddler or Charles, by examining the exact row requests you can usually find out the reason fo the failure.
BTW, the minor Unity version upgrade will not help you, cooky support was added somewhere in 2018.4/2019.1 era.
Try to remove all your lines related to cookies.
This API might also be helpful:
I have to have the cookie for the webRequest2 in the code.
I added the clearcookiecche in as the first line in Start, but it didn’t make a difference.
I will look into fiddler or charles.
Thanks again for the quick replies.
My apologies, forgot to update the status. Looks like clearing the cookies at the start fixed it. I had to restart unity once for it to work, but I’ve been developing without restarting unity for each test run for a couple of days now!
Thanks again for your help!
1 Like