自动图集是不是只能创建一个auto-atlas.pac的??

  • Creator 版本: 3.5.2

  • 目标平台: iOS / Android

  • 重现方式:添加两个auto-atlas.pac 在不同文件夹

  • 首个报错:

17:47:39 [ERROR]: 
Uncaught Exception:
 - location :  (see stack)
 - msg : Uncaught TypeError: Cannot read property 'width' of null
 - detail : 
       - [0]get width@src/cocos-js/cc.js:1
 - [1]drawTextureAt@src/cocos-js/cc.js:1
 - [2]insertSpriteFrame@src/cocos-js/cc.js:1
 - [3]insertSpriteFrame@src/cocos-js/cc.js:1
 - [4]packToDynamicAtlas@src/cocos-js/cc.js:1
 - [5]_updateFontFamily@src/cocos-js/cc.js:1
 - [6]updateRenderData@src/cocos-js/cc.js:1
 - [7]_applyFontTexture@src/cocos-js/cc.js:1
 - [8]onEnable@src/cocos-js/cc.js:1
 - [9]cP@src/cocos-js/cc.js:1
 - [10]invoke@src/cocos-js/cc.js:1
 - [11]activateNode@src/cocos-js/cc.js:1
 - [12]_onHierarchyChangedBase@src/cocos-js/cc.js:1
 - [13]_onHierarchyChanged@src/cocos-js/cc.js:1
 - [14]setParent@src/cocos-js/cc.js:1
 - [15]setParent@src/cocos-js/cc.js:1
 - [16]set parent@src/cocos-js/cc.js:1
 - [17]createNode@assets/main/index.jsc:131
 - [18]anonymous@assets/main/index.jsc:131
 - [19]anonymous@src/cocos-js/cc.js:1

JS: [ERROR]: (see stack) Uncaught TypeError: Cannot read property 'width' of null  - [0]get width@src/cocos-js/cc.js:1
 - [1]drawTextureAt@src/cocos-js/cc.js:1
 - [2]insertSpriteFrame@src/cocos-js/cc.js:1
 - [3]insertSpriteFrame@src/cocos-js/cc.js:1
 - [4]packToDynamicAtlas@src/cocos-js/cc.js:1
 - [5]_updateFontFamily@src/cocos-js/cc.js:1
 - [6]updateRenderData@src/cocos-js/cc.js:1
 - [7]_applyFontTexture@src/cocos-js/cc.js:1
 - [8]onEnable@src/cocos-js/cc.js:1
 - [9]cP@src/cocos-js/cc.js:1
 - [10]invoke@src/cocos-js/cc.js:1
 - [11]activateNode@src/cocos-js/cc.js:1
 - [12]_onHierarchyChangedBase@src/cocos-js/cc.js:1
 - [13]_onHierarchyChanged@src/cocos-js/cc.js:1
 - [14]setParent@src/cocos-js/cc.js:1
 - [15]setParent@src/cocos-js/cc.js:1
 - [16]set parent@src/cocos-js/cc.js:1
 - [17]createNode@assets/main/index.jsc:131
 - [18]anonymous@assets/main/index.jsc:131
 - [19]anonymous@src/cocos-js/cc.js:1
[ERROR] (/Users/dwb/Downloads/CocosEditors/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/bindings/jswrapper/v8/Object.cpp, 530): Invoking function (0x281ba0780) failed!
ERROR: Uncaught TypeError: Cannot read property 'width' of null, location: src/cocos-js/cc.js:0:0
STACK:
 - [0]get width@src/cocos-js/cc.js:1
 - [1]drawTextureAt@src/cocos-js/cc.js:1
 - [2]insertSpriteFrame@src/cocos-js/cc.js:1
 - [3]insertSpriteFrame@src/cocos-js/cc.js:1
 - [4]packToDynamicAtlas@src/cocos-js/cc.js:1
 - [5]_updateFontFamily@src/cocos-js/cc.js:1
 - [6]updateRenderData@src/cocos-js/cc.js:1
 - [7]_applyFontTexture@src/cocos-js/cc.js:1
 - [8]onEnable@src/cocos-js/cc.js:1
 - [9]cP@src/cocos-js/cc.js:1
 - [10]invoke@src/cocos-js/cc.js:1
 - [11]activateNode@src/cocos-js/cc.js:1
 - [12]_onHierarchyChangedBase@src/cocos-js/cc.js:1
 - [13]_onHierarchyChanged@src/cocos-js/cc.js:1
 - [14]setParent@src/cocos-js/cc.js:1
 - [15]setParent@src/cocos-js/cc.js:1
 - [16]set parent@src/cocos-js/cc.js:1
 - [17]createNode@assets/main/index.jsc:131
 - [18]anonymous@assets/main/index.jsc:131
 - [19]anonymous@src/cocos-js/cc.js:1

我只要删掉一个auto-atlas.pac他就不报错了

  • 之前哪个版本是正常的:
  • 手机型号:
  • 手机浏览器:
  • 编辑器操作系统:
  • 重现概率:

有人吗有人吗

可以使用多个,是不是资源被剔除了?

我看了打包后有两个图集 怎么看有没有被删除的?

QQ截图20220701191617 微信截图_20220701191808

一直没处理吗??? 2.4.9还是有这个问题

老哥 我这是3.5.2的问题 我这个也算是内存泄漏 他会一直报错 内存一直增加 最后卡死

我只是 借个楼 :rofl:

:cow: :beer:

21:30:34 [ERROR]: [ERROR] file /Users/dwb/Downloads/CocosEditors/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/application/CocosApplication.cpp: line 140 
21:30:34 [ERROR]: 
Uncaught Exception:
 - location :  
 - msg : unhandledRejectedPromise
 - detail : 
      TypeError: Cannot read property 'decRef' of undefined
PromiseConstructor Promisestacktrace: 
 - [0]remove@assets/main/index.jsc:49
 - [1]removeByUuid@assets/main/index.jsc:131
 - [2]anonymous@assets/main/index.jsc:131
 - [3]clear@assets/main/index.jsc:131
 - [4]clear@assets/main/index.jsc:145
 - [5]enterState@assets/main/index.jsc:71
 - [6]enterPreviousState@assets/main/index.jsc:71
 - [7]onExitRoomRes@assets/main/index.jsc:235
 - [8]anonymous@assets/main/index.jsc:233
 - [9]onResponse@assets/main/index.jsc:233
 - [10]handlePacket@assets/main/index.jsc:221
 - [11]anonymous@assets/main/index.jsc:29
 - [12]anonymous@assets/main/index.jsc:351


JS: [ERROR]:  unhandledRejectedPromise TypeError: Cannot read property 'decRef' of undefined
PromiseConstructor Promisestacktrace: 
 - [0]remove@assets/main/index.jsc:49
 - [1]removeByUuid@assets/main/index.jsc:131
 - [2]anonymous@assets/main/index.jsc:131
 - [3]clear@assets/main/index.jsc:131
 - [4]clear@assets/main/index.jsc:145
 - [5]enterState@assets/main/index.jsc:71
 - [6]enterPreviousState@assets/main/index.jsc:71
 - [7]onExitRoomRes@assets/main/index.jsc:235
 - [8]anonymous@assets/main/index.jsc:233
 - [9]onResponse@assets/main/index.jsc:233
 - [10]handlePacket@assets/main/index.jsc:221
 - [11]anonymous@assets/main/index.jsc:29
 - [12]anonymous@assets/main/index.jsc:351

21:30:34 [ERROR]: [ERROR] file /Users/dwb/Downloads/CocosEditors/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/application/CocosApplication.cpp: line 140 
21:30:34 [ERROR]: 
Uncaught Exception:
 - location :  
 - msg : handlerAddedAfterPromiseRejected
 - detail : 
      stacktrace: 
 - [0]removeByUuid@assets/main/index.jsc:131
 - [1]anonymous@assets/main/index.jsc:131
 - [2]clear@assets/main/index.jsc:131
 - [3]clear@assets/main/index.jsc:145
 - [4]enterState@assets/main/index.jsc:71
 - [5]enterPreviousState@assets/main/index.jsc:71
 - [6]onExitRoomRes@assets/main/index.jsc:235
 - [7]anonymous@assets/main/index.jsc:233
 - [8]onResponse@assets/main/index.jsc:233
 - [9]handlePacket@assets/main/index.jsc:221
 - [10]anonymous@assets/main/index.jsc:29
 - [11]anonymous@assets/main/index.jsc:351


JS: [ERROR]:  handlerAddedAfterPromiseRejected stacktrace: 
 - [0]removeByUuid@assets/main/index.jsc:131
 - [1]anonymous@assets/main/index.jsc:131
 - [2]clear@assets/main/index.jsc:131
 - [3]clear@assets/main/index.jsc:145
 - [4]enterState@assets/main/index.jsc:71
 - [5]enterPreviousState@assets/main/index.jsc:71
 - [6]onExitRoomRes@assets/main/index.jsc:235
 - [7]anonymous@assets/main/index.jsc:233
 - [8]onResponse@assets/main/index.jsc:233
 - [9]handlePacket@assets/main/index.jsc:221
 - [10]anonymous@assets/main/index.jsc:29
 - [11]anonymous@assets/main/index.jsc:351

21:30:34 [ERROR]: [ERROR] file /Users/dwb/Downloads/CocosEditors/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/application/CocosApplication.cpp: line 140 
21:30:34 [ERROR]: 
Uncaught Exception:
 - location :  
 - msg : unhandledRejectedPromise
 - detail : 
      TypeError: Cannot read property 'decRef' of undefined
PromiseConstructor Promisestacktrace: 
 - [0]remove@assets/main/index.jsc:49
 - [1]removeByUuid@assets/main/index.jsc:131
 - [2]removeByUuid@assets/main/index.jsc:149
 - [3]anonymous@assets/main/index.jsc:131
 - [4]clear@assets/main/index.jsc:131
 - [5]clear@assets/main/index.jsc:149
 - [6]clear@assets/main/index.jsc:145
 - [7]enterState@assets/main/index.jsc:71
 - [8]enterPreviousState@assets/main/index.jsc:71
 - [9]onExitRoomRes@assets/main/index.jsc:235
 - [10]anonymous@assets/main/index.jsc:233
 - [11]onResponse@assets/main/index.jsc:233
 - [12]handlePacket@assets/main/index.jsc:221
 - [13]anonymous@assets/main/index.jsc:29
 - [14]anonymous@assets/main/index.jsc:351


JS: [ERROR]:  unhandledRejectedPromise TypeError: Cannot read property 'decRef' of undefined
PromiseConstructor Promisestacktrace: 
 - [0]remove@assets/main/index.jsc:49
 - [1]removeByUuid@assets/main/index.jsc:131
 - [2]removeByUuid@assets/main/index.jsc:149
 - [3]anonymous@assets/main/index.jsc:131
 - [4]clear@assets/main/index.jsc:131
 - [5]clear@assets/main/index.jsc:149
 - [6]clear@assets/main/index.jsc:145
 - [7]enterState@assets/main/index.jsc:71
 - [8]enterPreviousState@assets/main/index.jsc:71
 - [9]onExitRoomRes@assets/main/index.jsc:235
 - [10]anonymous@assets/main/index.jsc:233
 - [11]onResponse@assets/main/index.jsc:233
 - [12]handlePacket@assets/main/index.jsc:221
 - [13]anonymous@assets/main/index.jsc:29
 - [14]anonymous@assets/main/index.jsc:351

21:30:34 [ERROR]: [ERROR] file /Users/dwb/Downloads/CocosEditors/Creator/3.5.2/CocosCreator.app/Contents/Resources/resources/3d/engine/native/cocos/application/CocosApplication.cpp: line 140 
21:30:34 [ERROR]: 
Uncaught Exception:
 - location :  
 - msg : handlerAddedAfterPromiseRejected
 - detail : 
      stacktrace: 
 - [0]removeByUuid@assets/main/index.jsc:131
 - [1]removeByUuid@assets/main/index.jsc:149
 - [2]anonymous@assets/main/index.jsc:131
 - [3]clear@assets/main/index.jsc:131
 - [4]clear@assets/main/index.jsc:149
 - [5]clear@assets/main/index.jsc:145
 - [6]enterState@assets/main/index.jsc:71
 - [7]enterPreviousState@assets/main/index.jsc:71
 - [8]onExitRoomRes@assets/main/index.jsc:235
 - [9]anonymous@assets/main/index.jsc:233
 - [10]onResponse@assets/main/index.jsc:233
 - [11]handlePacket@assets/main/index.jsc:221
 - [12]anonymous@assets/main/index.jsc:29
 - [13]anonymous@assets/main/index.jsc:351


JS: [ERROR]:  handlerAddedAfterPromiseRejected stacktrace: 
 - [0]removeByUuid@assets/main/index.jsc:131
 - [1]removeByUuid@assets/main/index.jsc:149
 - [2]anonymous@assets/main/index.jsc:131
 - [3]clear@assets/main/index.jsc:131
 - [4]clear@assets/main/index.jsc:149
 - [5]clear@assets/main/index.jsc:145
 - [6]enterState@assets/main/index.jsc:71
 - [7]enterPreviousState@assets/main/index.jsc:71
 - [8]onExitRoomRes@assets/main/index.jsc:235
 - [9]anonymous@assets/main/index.jsc:233
 - [10]onResponse@assets/main/index.jsc:233
 - [11]handlePacket@assets/main/index.jsc:221
 - [12]anonymous@assets/main/index.jsc:29
 - [13]anonymous@assets/main/index.jsc:351

这又是什么原因导致的 为啥web上没事 原生就有事。。。

这段代码有问题。。。我不手动释放了。。。

 /** 通过资源相对路径释放资源 */
  public release(path: string, bundleName: string = "resources") {
    const bundle = assetManager.getBundle(bundleName);
    if (bundle) {
      const asset = bundle.get(path);
      if (asset) {
        this.releasePrefabDepsRecursively(asset._uuid);
      }
    }
  }

  /** 释放预制依赖资源 */
  private releasePrefabDepsRecursively(uuid: string) {
    const asset = assetManager.assets.get(uuid)!;
    if (asset instanceof Prefab) {
      const uuids: string[] = assetManager.dependUtil.getDepsRecursively(uuid)!;
      uuids.forEach((uuid) => {
        // FIXME 应该就是这里导致的错误
        assetManager.assets.get(uuid)!.decRef();
      });
    }
    assetManager.releaseAsset(asset);
  }

好了 我不使用上面的代码后 连第一个问题都解决了。。。。。

我还有一个问题 经常同一个页面 第一次进来和第二次进来的dc不一样 第二次的dc会比较高 然后第二次和第3次还可能会不一样 dc会逐渐增加 还有非常偶然的一次 我发现dc猛增加了快100 绝对是自动图集被释放了 碎图没有再重新合图

用了自动图集打包以后就resources.load不到了

可能是自动合图满了,打断了原有的合批

问了下相关人员,没复现这个问题,你那边方便提供简单的复现 demo?

如果都在图集上了需要先加载图集,在通过 atlas.getSpriteFrame() 获取;
image

越想越不靠谱 等我出了第一版后 所有图集自己整了。。

还有一个反馈 经常动不动一刷新预览或者构建的时候就蹦出来几条错误

但是我点这几条错误的时候 文件都是在的 都能找到

:sob: :sob: :sob: 经常刷新预览控制台就给我报一些莫名其妙的错误

哪个版本?知道怎么复现吗?