用了Unity2022打包WebGL,控制台显示
[UnityCache] Error when initializing cache: Error: Could not connect to cache: Cache API is not supported.
[UnityCache] Failed to load 'http://xxxx/Build/8ac948a9501598649313d175b8948113.js.unityweb' from indexedDB cache due to the error: Error: Could not connect to cache: Cache API is not supported.
解决办法官网上有
WebGL 中的缓存行为 - Unity 手册 (unity3d.com)
在 config里配置 cacheControl 即可,我这里配置了 bundle 和 unityweb 类型。
刷新后显示,资源走的是磁盘缓存,加载速度快了很多。