assetbundle真机中怎么读取bundle包中index.js

image
这里面我打印了发现assetManager.loadBundle(‘Sys’, 并没读到index.js
怎么加载这个index.js呢

加载这个bundle就会加载这个index.js

在3.8.1的资源加载源码中,可以清晰看到,一个bundle的加载其实是需要加载两个文件

  • config.json
  • index.js

image

好了,我的问题,感谢大佬们回复,MainScene根对应的脚本MainScene.ts都得拉出来不能放到bundle里image

因为你的scene没有分包放在主包,当主包引用分包代码时,分包还没有加载所以有问题

好的。scene没放在主包是发布时第一个场景不让放在bundle里 :joy: 无奈mainLoading只场景拿出来了,真机测试图片在sys的bundle里可以通过mainLoading的scene自动读出来,但是场景中空间绑定的脚本不行。所以都拉出来了MainLoading脚本中assetBundleloadBundle(Sys)后再其他业务逻辑。
你们是怎么设计的呀 :smiley: :grinning: