From e44a03926ec5366769eefa855e7c192a1a620ab6 Mon Sep 17 00:00:00 2001 From: Cocos Ass Date: Wed, 4 Apr 2018 16:44:48 +0800 Subject: [PATCH] fixed the particleSystem memory leak problem fix --- cocos2d/particle/CCSGParticleSystem.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cocos2d/particle/CCSGParticleSystem.js b/cocos2d/particle/CCSGParticleSystem.js index 98e4c1fcaf..46cb048a2a 100644 --- a/cocos2d/particle/CCSGParticleSystem.js +++ b/cocos2d/particle/CCSGParticleSystem.js @@ -338,13 +338,17 @@ _ccsg.ParticleSystem = _ccsg.Node.extend({ } }, - _createRenderCmd: function(){ + _createRenderCmd: function () { if(cc._renderType === cc.game.RENDER_TYPE_CANVAS) return new _ccsg.ParticleSystem.CanvasRenderCmd(this); else return new _ccsg.ParticleSystem.WebGLRenderCmd(this); }, - + onEnter: function () { + // udpate after action in run! + this.scheduleUpdateWithPriority(1); + _ccsg.Node.prototype.onEnter.call(this); + }, /** * This is a hack function for performance, it's only available on Canvas mode.
* It's very expensive to change color on Canvas mode, so if set it to true, particle system will ignore the changing color operation. @@ -1364,8 +1368,6 @@ _ccsg.ParticleSystem = _ccsg.Node.extend({ // colorModulate = YES; this.autoRemoveOnFinish = false; - // udpate after action in run! - this.scheduleUpdateWithPriority(1); this._renderCmd._initWithTotalParticles(numberOfParticles); return true; },