As far as I understand, autoRemoveOnFinish only works only when the duration has a finite value. But what if I stop the particle system at some point, will it remove the node after no particles left? for example

CCParticleSun *particleSun = [CCParticleSun node];
particleSun.autoRemoveOnFinish = YES;
[self addChild: particleSun];

and at some point in the game I set

[particleSun stopSystem];

Will this remove the node after no particles left? Thank you in advance for helping.

有帮助吗?

解决方案

The answer is yes.See the method -(void) update: (ccTime) dt in CCParticleSystem.m

    if( particleCount == 0 && autoRemoveOnFinish_ ) {
                [self unscheduleUpdate];
                [parent_ removeChild:self cleanup:YES];
                return;
            }

Try to set a breakpoint here to check,this will be called after no particles left.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top