mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
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:
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user