Hi everyone,
I’m facing an issue with Asset Bundles in Cocos Creator 2.4.7 when trying to share a scene between projects.
What I did:
- In Project A, I created a folder (e.g.,
GameSceneBundle
) and placed my scene (game.scene
) inside it. - Based on the Cocos documentation, all dependencies of the scene (scripts, prefabs, textures, etc.) should be auto-included when the bundle is built.
- I marked the folder as an Asset Bundle via the Inspector.
- Then built the bundle with:
JS Encryption
: DisabledMD5 Cache
: Disabled- Target platform: Android
- I uploaded the bundle to a remote server.
In Project B:
I tried to load the remote bundle using:
cc.assetManager.loadBundle("AssetbundleLink", (err, bundle) => {
if (err) {
console.error("Failed to load bundle:", err.message || err);
return;
}
bundle.loadScene("game", (err, scene) => {
if (err) {
console.error("Failed to load scene:", err.message || err);
return;
}
cc.director.runSceneImmediate(scene);
});
});
Problem:
The bundle loads, but:
Failed to load scene
Cannot find class 'e54cdo32K9Gf6rlZLeVw0j0'
Simulator: JS: [WARN]: Read file failed: path: ... .json
It seems like the scene loads without its scripts or dependencies, causing it to fail