We’ve found that if using Unity 2022 beta with BestHttp2 added to the project that any UnityWebRequest made will result in a type error in the browser. Tested on 2022.1.0b2 & 2022.1.0b10 and issue persists, on 2020 LTS problem does not appear.
We’ve gone ahead and created a bug ticket but would be great to know if anyone else has come across this and found a resolution.
Log excerpts:
Console:
Build 2.loader.js:70 exception thrown: TypeError: Cannot set properties of undefined (setting ‘1’),TypeError: Cannot set properties of undefined (setting ‘1’)
at _JS_WebRequest_Create (http://localhost:57156/Build/Build%202.framework.js:2799:40)
Framework.js
function _JS_WebRequest_Create(url, method) {
var _url = UTF8ToString(url);
var _method = UTF8ToString(method);
var abortController = new AbortController();
var requestOptions = {
url: _url,
init: {
method: _method,
signal: abortController.signal,
headers: {}
}
};
wr.abortControllers[wr.nextRequestId] = abortController; **Error here
wr.requests[wr.nextRequestId] = requestOptions;
return wr.nextRequestId++;
}
Got the same error in 2021.3.9f1 - your solution fixed it for me. Thank you so much!
But hopefully unity is fixing this too anyway and this is not another workaround to remember for years now.
Hope you found out since then but if anyone else is having the same trouble… You need to build without compression. Otherwise, the file is embeded and you can’t read and modify it.