收藏
回答

unityWebGL项目导入小程序:AbortController is not defined?

求高手拆招,unity使用WebGL方式导出,再导入微信小游戏后,编译报错如下:

问题一:来自微信插件plugin.js:74

exception thrown: ReferenceError: AbortController is not defined,ReferenceError: AbortController is not defined

    at _JS_WebRequest_Create (http://127.0.0.1:42687/game/webgl.wasm.framework.unityweb.js:3:61167)

    at TransportJavaScript::DoRequest(TransportDoRequestArgsProto<HeaderHelper, DownloadHandler, UploadHandler, CertificateHandler, ResponseHelper> const&) (<anonymous>:wasm-function[33276]:0xa4f204)

    at UnityWebRequestProto<UnityWebRequestTransport, AtomicRefCounter, RedirectHelper, ResponseHelper, DownloadHandler, UploadHandler, CertificateHandler, HeaderHelper, AsyncOperation>::Task_DoRequest(void*) (<anonymous>:wasm-function[32057]:0xa0b0d3)

    at UnityWebRequestProto<UnityWebRequestTransport, AtomicRefCounter, RedirectHelper, ResponseHelper, DownloadHandler, UploadHandler, CertificateHandler, HeaderHelper, AsyncOperation>::Job_ExecuteUnityWebRequest(UnityWebRequestProto<UnityWebRequestTransport, AtomicRefCounter, RedirectHelper, ResponseHelper, DownloadHandler, UploadHandler, CertificateHandler, HeaderHelper, AsyncOperation>*) (<anonymous>:wasm-function[32060]:0xa0b548)

    at UnityWebRequestProto<UnityWebRequestTransport, AtomicRefCounter, RedirectHelper, ResponseHelper, DownloadHandler, UploadHandler, CertificateHandler, HeaderHelper, AsyncOperation>::Begin() (<anonymous>:wasm-function[16183]:0x5a4848)

    at UnityWebRequest::Begin() (<anonymous>:wasm-function[32071]:0xa0b7f9)

    at UnityEngine::Analytics::WebRequestRestClient::PerformPost() (<anonymous>:wasm-function[9787]:0x3297a0)

    。。。。。

    at n (http://127.0.0.1:42687/game/__dev__/WAGameSubContext.js:1:24431)(env: Windows,mg,1.06.2206090; lib: 2.25.0)

plugin.js:74 WebGL: INVALID_OPERATION: drawElements: no valid shader program in use



问题二:来自VM536 WAGameSubContext.js:1

Unhandled promise rejection TypeError: Browser.mainLoop.scheduler is not a function

    at Object.resume (webgl.wasm.framework.unityweb.js:3)

    at Object.calledMainCb (plugin.js:74)

    at callMain (webgl.wasm.framework.unityweb.js:3)

    at doRun (webgl.wasm.framework.unityweb.js:3)

    at run (webgl.wasm.framework.unityweb.js:3)

    at runCaller (webgl.wasm.framework.unityweb.js:3)

    at removeRunDependency (webgl.wasm.framework.unityweb.js:3)

    at receiveInstance (webgl.wasm.framework.unityweb.js:3)

    at receiveInstantiationResult (webgl.wasm.framework.unityweb.js:3)

    at VM536 WAGameSubContext.js:1

    at n (VM536 WAGameSubContext.js:1)(env: Windows,mg,1.06.2206090; lib: 2.25.0)

回答关注问题邀请回答
收藏

4 个回答

  • Cosette
    Cosette
    2022-10-30

    第一个问题,替换打包出的文件中Build文件夹下项目名.framework.js文件内的js代码

    var wr = { requestInstances: {}, nextRequestId: 1, loglevel: 2 };
    

    改成:

    var wr = { requestInstances: {}, nextRequestId: 1, loglevel: 2, responses:{}, timer:{}, requests:{}, abortControllers:{} };
    


    2022-10-30
    有用 2
    回复 1
    • 村支书
      村支书
      2023-01-06
      我按照你说的解决了
      2023-01-06
      回复
  • 葡萄成熟时
    葡萄成熟时
    2023-06-30

    请问第二个问题解决了吗?

    2023-06-30
    有用
    回复
  • Garin
    Garin
    2023-03-01

    请问第二个问题解决了吗?

    2023-03-01
    有用
    回复
  • 佚~
    佚~
    2022-07-24

    您好 解决了吗 我这边也遇到相同的问题

    2022-07-24
    有用
    回复
登录 后发表内容