-
Creator 版本:2.4.3
-
目标平台: chrome浏览器 / Android
-
重现方式:退出场景
-
首个报错:首个报错为 Uncaught TypeError: Cannot read property ‘physics_material_update’ of null
-
之前哪个版本是正常的:
-
手机型号:
-
手机浏览器:
-
编辑器操作系统:
-
重现概率: 偶现
断点调试发现是调用 collider内的onDestroy时 this._material 引用计数为0 并且已经销毁,临时处理方案是修改onDestroy 函数为:
cc.Collider3D.prototype.onDestroy = function () {
if (!CC_EDITOR) {
if (this._material && this._material.isValid) {
this._material.off('physics_material_update', this._updateMaterial, this);
}
this._shape.onDestroy();
}
}
代码中并没有操作材质的引用计数,只有切换场景前释放预制件的代码,目前已经调整到切换场景后,不知是否由此引起
