mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
fix particle destroy attatched to uimodel (#5504)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user