I’m running into a weird issue, where I call UnityWebRequest, and it succeeds in 2020 LTS, but not in 2021 LTS. This is on a WebGL build. In the Unity Editor, it works fine. I’m calling the exact same url under both versions. In 2021 LTS, I get result ConnectionError.
The server is a .NET 6.0 console application.
Anyone have any ideas where I can look into this more? Or is there a known issue with 2021 LTS WebGL builds?
Always the device / runtime / browser logs, obviously.
Networking, UnityWebRequest, WWW, Postman, curl, WebAPI, etc:
https://discussions.unity.com/t/831681/2
https://discussions.unity.com/t/837672/2
And setting up a proxy can be very helpful too, in order to compare traffic:
https://support.unity.com/hc/en-us/articles/115002917683-Using-Charles-Proxy-with-Unity
Ah, I can always count on Kurt-Dekker’s copy and paste response to be at the ready. If it weren’t so helpful, I would otherwise find it annoying.
Thanks, I try. I am always amending my copy/pasta stuff, plus often it gets hand-modified as I post it for a particular answer.
I am always open to suggestions for how to make it more useful, so don’t be shy if you have ideas!
aer0ace
November 11, 2022, 3:25pm
5
Hello.
We are having some troubles resolving HTTP error trying to load some local files in the WebGL build made with Unity 2021.3.6f1 and bundled with a Javascript application running in the browser.
Error code is 500
WebGL client is using UnityWebRequest to fetch a file from localhost.
After request fails webRequest.result field has value Connection Error, webRequest.error filed has value Unknown Error
Example of URL used: https://127.0.0.1:8000/@/artifacts/loader/empty-scenes/contents/QmQye…
This is actually exactly what’s happening with my build. Has anyone else experienced this problem?