-
Creator 版本:1.9.1
-
目标平台:微信小游戏
-
详细报错信息,包含调用堆栈:
gameThirdScriptError
Cannot read property 'destroy' of null
TypeError: Cannot read property 'destroy' of null
at Audio.23.proto.destroy (http://127.0.0.1:64194/game/cocos2d-js.0c456.js:5530:22)
at CCClass.onDestroy (http://127.0.0.1:64194/game/cocos2d-js.0c456.js:13911:20)
at CCClass.destroyComp (http://127.0.0.1:64194/game/cocos2d-js.0c456.js:26759:67)
at CCClass._onPreDestroy (http://127.0.0.1:64194/game/cocos2d-js.0c456.js:14541:36)
at CCClass.147.prototype._destroyImmediate (http://127.0.0.1:64194/game/cocos2d-js.0c456.js:28641:34)
at CCClass._onPreDestroy (http://127.0.0.1:64194/game/cocos2d-js.0c456.js:35850:21)
at CCClass._onPreDestroy (http://127.0.0.1:64194/game/cocos2d-js.0c456.js:9996:36)
at CCClass.147.prototype._destroyImmediate (http://127.0.0.1:64194/game/cocos2d-js.0c456.js:28641:34)
at Function.deferredDestroy (http://127.0.0.1:64194/game/cocos2d-js.0c456.js:28552:42)
at TheClass.mainLoop (http://127.0.0.1:64194/game/cocos2d-js.0c456.js:8472:23)
-
重现方式:在预设中挂载AudioSource即可
-
之前哪个版本是正常的 :1.9.0
-
出现概率:100%
-
额外线索:估计是跟这段代码有关
//CCAudio.js
proto.destroy = function () {
if (CC_WECHATGAME) {
this._element.destroy();
}
};
1.9.1中,如果prefab挂载了AudioSource,在这个prefab释放的时候,微信小游戏环境下会不断报错,导致游戏卡死。另外,如果AudioSource是PlayOnLoad的话,就没这个问题。