Fix bug of "Overwriting 'destroy' function in 'cc.ColliderComponentBase' class without calling super is not allowed. Call the super function in 'destroy' please" (#4367)

This commit is contained in:
jiaxin.lai
2019-05-05 14:22:52 +08:00
committed by pandamicro
parent 7dfc277ab2
commit a2743c427f
2 changed files with 3 additions and 4 deletions
@@ -91,11 +91,11 @@ export class ColliderComponentBase extends PhysicsBasedComponent {
}
}
public destroy () {
public onDestroy () {
if (this.sharedBody) {
this.sharedBody.body.removeShape(this._shapeBase!);
}
super.destroy();
super.onDestroy();
}
}
@@ -38,12 +38,11 @@ export class PhysicsBasedComponent extends Component {
}
}
public destroy () {
public onDestroy () {
if (this._sharedBody) {
this._sharedBody.deref();
this._sharedBody = null;
}
super.destroy();
}
private _refSharedBody () {