找回密码
 立即注册
查看: 251|回复: 0

unity2022 webgl 加载资源出错 exception thrown: TypeError ...

[复制链接]
发表于 2022-11-10 13:07 | 显示全部楼层 |阅读模式
老项目unity 2019升级到2022,项目中的错误
an abnonal sitution has occuret: th Playercop ifntenal funtion ha be called recursvly,Please contactlutorer Sipport with a saple pvoject so that ve cn rearouce theproblem and troubleshoot it.
UnityEngine.Networking.UnitywebRequest:BeginlebRequest()UnityEngine.Networking.UnitywebRequest:SendlebRequest()woogilorld.AssetBundles.ABLoadFileAsync :.ctor(String)
woogiWorld.AssetBundles.ABManager:LoadAssetBundleInternal(String,Boolean)WoogiWorld.AssetBundles.ABManager:LoadAssetBundle(String,Boolean)
woogilorld.AssetBundles.ABManager:Initialize(String)
woogivlorld.AssetBundles.ABManager : Initialize()
不知道为何,在知乎的照片特模糊,我保证 我上传的是高清图片。


模拟测试
public class Test3 : MonoBehaviour
{
    public string url ="https://*****/StreamingAssets/AssetBundle/WebGL/WebGL.webgl";
    public UnityWebRequestAsyncOperation webRequest;

    IEnumerator Start()
    {
        Debug.Log("Init Start:" + url);
        yield return new WaitForSeconds(5);
        webRequest =
            UnityWebRequestAssetBundle.GetAssetBundle(url).SendWebRequest();
        yield return 0;
        while (!webRequest.isDone)
        {
            yield return 0;
        }

        Debug.Log("Init Completed! " + webRequest.webRequest.downloadedBytes);
    }
}

exception thrown: TypeError: Cannot set properties of undefined (setting '1'),TypeError: Cannot set properties of undefined (setting '1')
    at _JS_WebRequest_Create (blob:http://127.0.0.1/d05375fb-4c26-4487-b2f5-4da97ff15bf5:3:75110)
    at wasm://wasm/0e8982b2:wasm-function[116220]:0x329bda1
    at wasm://wasm/0e8982b2:wasm-function[116194]:0x329b062
    at wasm://wasm/0e8982b2:wasm-function[116192]:0x329ab6f
    at wasm://wasm/0e8982b2:wasm-function[30151]:0xfd6ecb
    at wasm://wasm/0e8982b2:wasm-function[116196]:0x329b38d
    at wasm://wasm/0e8982b2:wasm-function[110639]:0x30d4b28
    at wasm://wasm/0e8982b2:wasm-function[26044]:0xd50a8e
    at invoke_ii (blob:http://127.0.0.1/d05375fb-4c26-4487-b2f5-4da97ff15bf5:3:417257)
    at wasm://wasm/0e8982b2:wasm-function[71278]:0x2337219
    at wasm://wasm/0e8982b2:wasm-function[108561]:0x307f1a9
    at invoke_iii (blob:http://127.0.0.1/d05375fb-4c26-4487-b2f5-4da97ff15bf5:3:415239)
    at wasm://wasm/0e8982b2:wasm-function[71276]:0x2337074
    at wasm://wasm/0e8982b2:wasm-function[108561]:0x307f1a9
    at invoke_iii (blob:http://127.0.0.1/d05375fb-4c26-4487-b2f5-4da97ff15bf5:3:415239)
    at wasm://wasm/0e8982b2:wasm-function[43978]:0x18049ef
    at wasm://wasm/0e8982b2:wasm-function[1172]:0x946fb
    at wasm://wasm/0e8982b2:wasm-function[108560]:0x307f19d
    at invoke_iiii (blob:http://127.0.0.1/d05375fb-4c26-4487-b2f5-4da97ff15bf5:3:415917)
    at wasm://wasm/0e8982b2:wasm-function[65617]:0x214db2e
    at wasm://wasm/0e8982b2:wasm-function[3315]:0x1689c3
    at wasm://wasm/0e8982b2:wasm-function[5719]:0x288bbb
    at wasm://wasm/0e8982b2:wasm-function[108560]:0x307f19d
    at invoke_iiii (blob:http://127.0.0.1/d05375fb-4c26-4487-b2f5-4da97ff15bf5:3:415917)
    at wasm://wasm/0e8982b2:wasm-function[1518]:0xb2f28
    at wasm://wasm/0e8982b2:wasm-function[30773]:0x1037671
    at wasm://wasm/0e8982b2:wasm-function[991]:0x8a889
    at wasm://wasm/0e8982b2:wasm-function[6673]:0x35b0da
    at wasm://wasm/0e8982b2:wasm-function[28874]:0xe99633
    at wasm://wasm/0e8982b2:wasm-function[114769]:0x320b7f2
    at wasm://wasm/0e8982b2:wasm-function[28898]:0xe9bd39
    at wasm://wasm/0e8982b2:wasm-function[31954]:0x1129b56
    at wasm://wasm/0e8982b2:wasm-function[31954]:0x1129bc7
    at wasm://wasm/0e8982b2:wasm-function[6561]:0x34ce53
    at wasm://wasm/0e8982b2:wasm-function[108554]:0x307f054
    at browserIterationFunc (blob:http://127.0.0.1/d05375fb-4c26-4487-b2f5-4da97ff15bf5:3:240659)
    at callUserCallback (blob:http://127.0.0.1/d05375fb-4c26-4487-b2f5-4da97ff15bf5:3:193857)
    at Object.runIter (blob:http://127.0.0.1/d05375fb-4c26-4487-b2f5-4da97ff15bf5:3:195117)
    at Browser_mainLoop_runner (blob:http://127.0.0.1/d05375fb-4c26-4487-b2f5-4da97ff15bf5:3:193392)

解决方案:1. 询问了国际友人


,他建议勾选 development, 结果并没什么用.


2. 老方法,剔除插件。 搞了几个小时,最后找到是 besthttp 所导致,我升级besthttp2_2.6.3,正常工作。
一共花了一天。
不管是堆栈信息抓包 也没法定位。只知道UnityWebRequestAssetBundle.GetAssetBundle(url) 就出错。只能一步一步的排查。
排查方法》创建一个空项目,把老项目的插件全部导入,不导入代码。在编写一个简单代码(UnityWebRequestAssetBundle.GetAssetBundle(url))测试。  这样比在老项目中排查 不知道快了多少倍。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-4-28 11:47 , Processed in 0.094974 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表