I probably blame myself for bad coding, but sometimes I just want to be sure that everything is deleted before moving on, so I've ended up calling Particles.CleanUp() more than once on a particular occasion.
Particle Candy obviously doesn't like that, since it causes an error (not necessarily a crash), saying it can't remove an object in the Emitter variable that doesn't exist.
But, I made a small change in lib_particle_candy.lua that made the error go away, so you can call it multiple times without Particle Candy complaining.
In the bottom of the DeleteEmitter() function, change this:
1 2 3 4 5 6 7 | -- REMOVE EMITTER Emitters[name].PTypes = nil Emitters[name].PTypeIndex = nil Emitters[name].PTypeSettings= nil Emitters[name]:removeSelf() Emitters[name] = nil if debug then print ("--> Particles.DeleteEmitter(): DELETED EMITTER '"..name.."'") end |
You should be able to call CleanUp() as many time as you like to. We couldn't reproduce this issue (using a simple test code), so it could eventually be related to something else.
Could you send in a small sample code that reproduces this issue?