Black screen when hot update by using Asset Manager

Hi everyone, I have an issue when I implement Asset Manager for hot update. After new resources download finished, I get problem when restart game, let me know if you need more info. Thanks.

  • Cocos2d-JS v3.17.
  • Xcode 10.1

Implement UPDATE_FINISHED event code:

case jsb.EventAssetsManager.UPDATE_FINISHED:
cc.log(“Update finished. " + event.getMessage());
// This value will be retrieved and appended to the default search path during game startup,
// please refer to samples/js-tests/main.js for detailed usage.
// !!! Re-add the search paths in main.js is very important, otherwise, new scripts won’t take effect.
var searchPaths = this._am.getLocalManifest().getSearchPaths();
cc.log(”***** Search path*****");
for (var i = 0; i < searchPaths.length; i++) {
cc.log(“searchPaths[i]);
}
cc.log(”*****");
// Register the manifest’s search path
cc.sys.localStorage.setItem(“search_path”, JSON.stringify(searchPaths));
cc.sys.localStorage.removeItem(this._KEY_DOWNLOADED_SIZE);

// Restart the game to make all scripts take effect.
cc.log(“End audio engine”);
cc.audioEngine.end && cc.audioEngine.end();
cc.director.purgeCachedData();
cc.loader.releaseAll();
cc.log(“Restart game”);
cc.game.restart();
break;

Console output

Update finished.

***** Search path *****
/Users/jonh_daniel/Library/Developer/CoreSimulator/Devices/85B1778C-A99A-4EEA-8EC6-974BA41B7922/data/Containers/Data/Application/6FF6C95D-7931-415D-A09A-A0F83CAD2F5C/Documents/remote_assets/


End audio engine
“/Users/jonh_daniel/Library/Developer/CoreSimulator/Devices/85B1778C-A99A-4EEA-8EC6-974BA41B7922/data/Containers/Bundle/Application/C3F17374-8C30-46D1-AAED-5FDB6B123432/MotalCombat-mobile.app/res/font/cam_stroke_32-export.png” rc=2 id=3 423 x 428 @ 32 bpp => 707 KB
“/Users/jonh_daniel/Library/Developer/CoreSimulator/Devices/85B1778C-A99A-4EEA-8EC6-974BA41B7922/data/Containers/Bundle/Application/C3F17374-8C30-46D1-AAED-5FDB6B123432/MotalCombat-mobile.app/res/logo.png” rc=2 id=2 321 x 321 @ 32 bpp => 402 KB
“/cc_2x2_white_image” rc=2 id=1 2 x 2 @ 32 bpp => 0 KB
TextureCache dumpDebugInfo: 3 textures, for 1109 KB (1.08 MB)

Restart game
basic_object_finalize 0x132c425e0 …
jsbindings: finalizing JS object 0x132c42610 (WebSocket)
jsbindings: finalizing JS object 0x132c42640 (SocketIO)
basic_object_finalize 0x132c42700 …
basic_object_finalize 0x132c42730 …
2019-12-10 10:20:49.028477+0700 MotalCombat-mobile[9934:253579] [si_destination_compare] send failed: Invalid argument
2019-12-10 10:20:49.028605+0700 MotalCombat-mobile[9934:253579] [si_destination_compare] send failed: Invalid argument
debug server : error creating/binding socket
Cocos2d-JS v3.17
JS: ScriptingCore:: compileScript fail:src/base.js
JS: /Users/jonh_daniel/Library/Developer/CoreSimulator/Devices/85B1778C-A99A-4EEA-8EC6-974BA41B7922/data/Containers/Bundle/Application/C3F17374-8C30-46D1-AAED-5FDB6B123432/MotalCombat-mobile.app/script/jsb_boot.js:431:Error: can’t open : No such file or directory

Evaluating main.js failed (evaluatedOK == JS_FALSE)
2019-12-10 10:22:19.108694+0700 MotalCombat-mobile[9934:253294] Received XPC error Connection interrupted for message type 3 kCFNetworkAgentXPCMessageTypePACQuery
2019-12-10 10:22:19.109244+0700 MotalCombat-mobile[9934:253294] Received XPC error Connection invalid for message type 3 kCFNetworkAgentXPCMessageTypePACQuery

1 Like