fix particle destroy attatched to uimodel (#5504)

This commit is contained in:
zxg0622
2019-10-09 17:29:38 +08:00
committed by pandamicro
parent 3badd93ad5
commit edae7c596c
5 changed files with 10 additions and 6 deletions
+1 -1
View File
@@ -194,7 +194,7 @@ export class ModelComponent extends RenderableComponent {
public onDestroy () {
if (this._model) {
this._getRenderScene().destroyModel(this._model);
this._model.scene.destroyModel(this._model);
this._model = null;
}
}
+1 -1
View File
@@ -466,7 +466,7 @@ export class ParticleSystemComponent extends RenderableComponent {
if (this.isValid) {
const r = this.renderer as any;
if (r && r._model) {
r._model.destroy();
r._model.scene.destroyModel(r._model);
r._model = null;
r.onEnable();
r._updateModel();
@@ -258,8 +258,10 @@ export default class ParticleSystemRenderer {
}
public onDestroy () {
this._particleSystem._getRenderScene().destroyModel(this._model!);
this._model = null;
if (this._model) {
this._model.scene.destroyModel(this._model);
this._model = null;
}
}
public clear () {
+1 -1
View File
@@ -357,7 +357,7 @@ export default class TrailModule {
public destroy () {
if (this._trailModel) {
this._particleSystem._getRenderScene().destroyModel(this._trailModel!);
this._trailModel.scene.destroyModel(this._trailModel);
this._trailModel = null;
}
if (this._trailSegments) {
+3 -1
View File
@@ -70,7 +70,9 @@ export class UIModelComponent extends UIComponent {
}
this._modelComponent._sceneGetter = null;
this._modelComponent.recreateModel();
if (cc.isValid(this.node, true)) {
this._modelComponent.recreateModel();
}
}
public updateAssembler (render: UI) {