A newbie asks about the operation of configuring as a Bundle

I have used several versions and found that my resources seem to be unable to be recognized. Finally, I found that someone said that after configuring it as a Bundle, a cc.assetbundle will be generated in this folder, but no matter which version of the software I use, I have never seen this file generated. After selecting the folder and configuring it as a Bundle, I assigned the priority. In order to prevent the resources from being missed, I specially added the files in all folders. After saving, I still didn’t see any cc.assetbundle generated. In fact, it would be fine if it can be used with or without, but now it can’t be used. I am a wild child without a teacher to teach me, so I can only ask the big guys to take care of me. My code content is: private async loadImages(): Promise {
const promises = this.TEST_RESOURCES.images.map((path, index) => {
return new Promise((resolve) => {
const bundleName = this.getBundleName(path);
const bundle = assetManager.getBundle(bundleName);

        if (!bundle) {
            if (bundleName === 'main') {
                warn(`äø»čµ„ęŗåŒ…ęœŖåŠ č½½ļ¼Œę— ę³•åŠ č½½čµ„ęŗ: ${path}`);
            } else {
                warn(`čµ„ęŗåŒ…${bundleName}ęœŖåŠ č½½ļ¼Œč·³čæ‡čµ„ęŗ: ${path}`);
            }
            resolve();
            return;
        }

        bundle.load(path, SpriteFrame, (err: Error | null, spriteFrame: SpriteFrame) => {
            if (err) {
                warn(`åŠ č½½å›¾ē‰‡å¤±č“„: ${path}`, err);
                this.tryAlternativeLoad(bundle, path, index).finally(resolve);
            } else if (index < this.displaySprites.length) {
                this.displaySprites[index].spriteFrame = spriteFrame;
                resolve();
            } else {
                resolve();
            }
        });
    });
});

await Promise.all(promises);

}

private getBundleName(path: string): string {
if (path.indexOf(ā€˜female_characters’) === 0) return ā€˜female-characters’;
if (path.indexOf(ā€˜pve_mode’) === 0) return ā€˜pve-mode’;
if (path.indexOf(ā€˜common_battle’) === 0) return ā€˜common-battle’;
return ā€˜main’;
} There are also resource paths in the code: private readonly TEST_RESOURCES = {
images: [
ā€˜textures/bg_t’, // Change to relative path
ā€˜female_characters/1_n/poses/1_n_stand’,
ā€˜pve_mode/boss/boss_male_seyou’, // Related path
ā€˜common_battle/items/icons/dingshen’
],
audio: ā€˜sounds/click’ // Change to relative path
}; The following is part of the error: [PreviewInEditor] Failed to load image: pve_mode/boss/boss_male_seyou Error: Bundle pve_mode doesn’t contain pve_mode/boss/boss_male_seyou
at parse (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:117036:25)
at Pipeline.sync (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:115715:28)
at preprocess (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:115993:53)
at Pipeline._flow (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:115759:11)
at Pipeline.async (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:115755:16)
at AssetManager.loadAny (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:109614:20)
at Bundle.load (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:112965:33)
at file:///K:/386/525/temp/programming/packer-driver/targets/editor/chunks/d0/file:/K:/386/525/assets/testscene.ts:102:24
at new Promise ()
at map (file:///K:/386/525/temp/programming/packer-driver/targets/editor/chunks/d0/file:/K:/386/525/assets/testscene.ts:88:20)
at Array.map ()
at TestScene.loadImages (file:///K:/386/525/temp/programming/packer-driver/targets/editor/chunks/d0/file:/K:/386/525/assets/testscene.ts:87:53)
at TestScene.loadAndDisplayResources (file:///K:/386/525/temp/programming/packer-driver/targets/editor/chunks/d0/file:/K:/386/525/assets/testscene.ts:77:22)
at TestScene.start (file:///K:/386/525/temp/programming/packer-driver/targets/editor/chunks/d0/file:/K:/386/525/assets/testscene.ts:32:24)
Error: [PreviewInEditor] Failed to load image: pve_mode/boss/boss_male_seyou Error: Bundle pve_mode doesn’t contain pve_mode/boss/boss_male_seyou
at Pipeline._flow (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:115759:11)
at Pipeline.async (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:115755:16)
at AssetManager.loadAny (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:109614:20)
at Bundle.load (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:112965:33)
at file:///K:/386/525/temp/programming/packer-driver/targets/editor/chunks/d0/file:/K:/386/525/assets/testscene.ts:102:24
at new Promise ()
at map (file:///K:/386/525/temp/programming/packer-driver/targets/editor/chunks/d0/file:/K:/386/525/assets/testscene.ts:88:20)
at Array.map ()
at TestScene.loadImages (file:///K:/386/525/temp/programming/packer-driver/targets/editor/chunks/d0/file:/K:/386/525/assets/testscene.ts:87:53)
at TestScene.loadAndDisplayResources (file:///K:/386/525/temp/programming/packer-driver/targets/editor/chunks/d0/file:/K:/386/525/assets/testscene.ts:77:22)
at TestScene.start (file:///K:/386/525/temp/programming/packer-driver/targets/editor/chunks/d0/file:/K:/386/525/assets/testscene.ts:32:24)
at Logger._logHandler (K:\cocosbianjiqi\Creator\3.8.6\resources\app.asar\builtin\scene\dist\script\3d\manager\startup\log.ccc:1:487)
at Logger.record (K:\cocosbianjiqi\Creator\3.8.6\resources\app.asar\node_modules@base\electron-logger\lib\renderer.ccc:1:458)
at console. (K:\cocosbianjiqi\Creator\3.8.6\resources\app.asar\node_modules@base\electron-logger\lib\renderer.ccc:1:1260)
at console.warn (K:\cocosbianjiqi\Creator\3.8.6\resources\app.asar\node_modules@sentry\src\instrument\console.ts:40:20)
at warn (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:146866:12)
at file:///K:/386/525/temp/programming/packer-driver/targets/editor/chunks/d0/file:/K:/386/525/assets/testscene.ts:104:25
at eval (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:117467:9)
at eval (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:151169:9)
at sentryWrapped (K:\cocosbianjiqi\Creator\3.8.6\resources\app.asar\node_modules\src\helpers.ts :100:17)

[PreviewInEditor] Failed to load image: common_battle/items/icons/dingshen Error: Bundle common_battle doesn’t contain common_battle/items/icons/dingshen It may be a bit messy, I’m very sorry QAQ

1 Like

spf type, the path must end with /spriteFrame

This is a test project that I have only done for a small part of the warehouse. I found that as long as I load dynamically, there will be problems. I have tried several paths and they all failed to load. I have asked several AIs to help me find the problem but they couldn’t find it. This version is a version that AI modified for me. The rest of the AI ​​didn’t say anything wrong, but it’s still wrong. I want a kind-hearted big man to give me a solution, or where is my problem? I use version 3.8.6, orz555~ I’m begging for ceshi.zip (169.6 KB)

I have also used backgrounds/fj_1_bg/spriteFrame, but the loading still failed: [PreviewInEditor] Failed to load resource backgrounds/fj_1_bg/spriteFrame: Error: Can not parse this input:{ā€œpathā€:ā€œbackgrounds/fj_1_bg/spriteFrameā€," requestType ā€œ:ā€œpathā€,ā€œbundleā€:ā€ā€œ,ā€œpresetā€:ā€œdefaultā€,ā€œpriorityā€:0}
at parse (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:117090:15)
at Pipeline.sync (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:115715:28)
at preprocess (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:115993:53)
at Pipeline._flow (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:115759:11)
at Pipeline.async (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:115755:16)
at AssetManager.loadAny (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:109614:20)
at Bundle.load (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:112965:33)
at file:///K:/386/ceshi/temp/programming/packer-driver/targets/editor/chunks/bd/file:/K:/386/ceshi/assets/WarehouseManager.ts:97:23
at new Promise ()
at WarehouseManager.loadSpriteFrame (file:///K:/386/ceshi/temp/programming/packer-driver/targets/editor/chunks/bd/file:/K:/386/ceshi/assets/WarehouseManager.ts:96:16)
at WarehouseManager.loadAllResources (file:///K:/386/ceshi/temp/programming/packer-driver/targets/editor/chunks/bd/file:/K:/386/ceshi/assets/WarehouseManager.ts:72:36)
at WarehouseManager.onLoad (file:///K:/386/ceshi/temp/programming/packer-driver/targets/editor/chunks/bd/file:/K:/386/ceshi/assets/WarehouseManager.ts:41:14)
at eval (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:50963:132)
at OneOffInvoker.eval [as _invoke] (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:48877:9)
at OneOffInvoker.invoke (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:48991:16)
at NodeActivator.activateNode (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:51014:27)
at Scene._activate (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:58797:44)
at Director.runSceneImmediate (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:19222:17)
at K:\cocosbianjiqi\Creator\3.8.6\resources\app.asar\builtin\scene\dist\script\3d\manager\scene\utils.ccc:1:1367
at eval (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:109875:17)
at eval (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:117467:9)
at eval (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:151169:9)
at sentryWrapped (K:\cocosbianjiqi\Creator\3.8.6\resources\app.asar\node_modules\src\helpers.ts :100:17)
Error: [PreviewInEditor] Failed to load resource backgrounds/fj_1_bg/spriteFrame: Error: Can not parse this input:{ā€œpathā€:ā€œbackgrounds/fj_1_bg/spriteFrameā€,ā€ requestType ā€œ:ā€œpathā€,ā€œbundleā€:ā€",ā€œpresetā€:ā€œdefaultā€,ā€œpriorityā€:0}
at Pipeline._flow (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:115759:11)
at Pipeline.async (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:115755:16)
at AssetManager.loadAny (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:109614:20)
at Bundle.load (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:112965:33)
at file:///K:/386/ceshi/temp/programming/packer-driver/targets/editor/chunks/bd/file:/K:/386/ceshi/assets/WarehouseManager.ts:97:23
at new Promise ()
at WarehouseManager.loadSpriteFrame (file:///K:/386/ceshi/temp/programming/packer-driver/targets/editor/chunks/bd/file:/K:/386/ceshi/assets/WarehouseManager.ts:96:16)
at WarehouseManager.loadAllResources (file:///K:/386/ceshi/temp/programming/packer-driver/targets/editor/chunks/bd/file:/K:/386/ceshi/assets/WarehouseManager.ts:72:36)
at WarehouseManager.onLoad (file:///K:/386/ceshi/temp/programming/packer-driver/targets/editor/chunks/bd/file:/K:/386/ceshi/assets/WarehouseManager.ts:41:14)
at eval (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:50963:132)
at OneOffInvoker.eval [as _invoke] (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:48877:9)
at OneOffInvoker.invoke (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:48991:16)
at NodeActivator.activateNode (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:51014:27)
at Scene._activate (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:58797:44)
at Director.runSceneImmediate (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:19222:17)
at K:\cocosbianjiqi\Creator\3.8.6\resources\app.asar\builtin\scene\dist\script\3d\manager\scene\utils.ccc:1:1367
at eval (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:109875:17)
at eval (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:117467:9)
at eval (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:151169:9)
at sentryWrapped (K:\cocosbianjiqi\Creator\3.8.6\resources\app.asar\node_modules\src\helpers.ts :100:17)
at Logger._logHandler (K:\cocosbianjiqi\Creator\3.8.6\resources\app.asar\builtin\scene\dist\script\3d\manager\startup\log.ccc:1:487)
at Logger.record (K:\cocosbianjiqi\Creator\3.8.6\resources\app.asar\node_modules@base\electron-logger\lib\renderer.ccc:1:458)
at console. (K:\cocosbianjiqi\Creator\3.8.6\resources\app.asar\node_modules@base\electron-logger\lib\renderer.ccc:1:1414)
at console.error (K:\cocosbianjiqi\Creator\3.8.6\resources\app.asar\node_modules@sentry\src\instrument\console.ts:40:20)
at file:///K:/386/ceshi/temp/programming/packer-driver/targets/editor/chunks/bd/file:/K:/386/ceshi/assets/WarehouseManager.ts:99:29
at eval (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:117467:9)
at eval (K:\cocosbianjiqi\Creator\3.8.6\resources\resources\3d\engine\bin.cache\dev\editor\bundled\index.js:151169:9)
at sentryWrapped (K:\cocosbianjiqi\Creator\3.8.6\resources\app.asar\node_modules\src\helpers.ts :100:17)

The loading interface you use is resources.load, which is used to load built-in bundles, i.e., the ones in resources. Your files are placed in backgrounds and common_battle bundles respectively, and your paths are ā€˜backgrounds/fj_1_bg/spriteFrame’ and ā€˜common_battle/beiji/spriteFrame’. The paths in the interface are relative to the bundle you want to load, so there are problems with your bundle and path. Please check the corresponding interface API and documentation.

resources is a built-in bundle, equivalent to assetsManager.loadBundle(ā€˜resources’), but the interface is resources.load.

Load a custom bundle using assetManager.loadBundle

The main problem is the understanding of bundle. I suggest you read the official documentation in detail.