From ccc5d4993829fb04edcd396cdc352672d7fee9b6 Mon Sep 17 00:00:00 2001 From: even Date: Thu, 18 Jul 2024 10:36:50 +0800 Subject: [PATCH] Fixed an error when stopping previewing while particles are hidden (#17381) --- cocos/particle-2d/particle-simulator-2d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/particle-2d/particle-simulator-2d.ts b/cocos/particle-2d/particle-simulator-2d.ts index 8436e3b882..e6f979681a 100644 --- a/cocos/particle-2d/particle-simulator-2d.ts +++ b/cocos/particle-2d/particle-simulator-2d.ts @@ -140,7 +140,7 @@ export class Simulator { const particles = this.particles; for (let id = 0; id < particles.length; ++id) pool.put(particles[id]); particles.length = 0; - this.renderData.resize(0, 0); + if (this.renderData) this.renderData.resize(0, 0); } public emitParticle (pos): void {