您现在的位置是:首页 >技术杂谈 >unity webgl 平台 数据缓存(二次秒开)[UnityCache]网站首页技术杂谈

unity webgl 平台 数据缓存(二次秒开)[UnityCache]

車到山前 2025-03-27 12:01:01
简介unity webgl缓存问题

开启缓存数据功能后,unity 2022 部署到 nginx 服务器后(网上的朋友说 配置https 就可解决无法缓存问题),用户使用中控制台打印这样的错误:

[UnityCache] Error when initializing cache: Error: Could not connect to cache: Cache API is not supported

[UnityCache] Failed to load 'http://xxxx/Build/8ac222a9501598649313d175b8948333.js.unityweb' from indexedDB cache due to the error: Error: Could not connect to cache: Cache API is not supported.

根据错误得出结论是:unity 缓存数据,在浏览器中没有起到作用。

解决方法是 修改 build / xxxxx.loader.js 文件

 从 unity 2021.3.22f1c1 打包找到 build / xxxxx.loader.js 文件文件,替换至当前工程。

不要问我这么知道这种方法的,这是历史更新问题

或者点击下载该文件尝试替换(打包的名称.loader.js )

[UnityCache]Errorwheninitializingcache:Error:Couldnotconnecttocache:CacheAPIisnotsupp资源-CSDN文库

风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。