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:
[lua] – 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[/lua]
to this:
[lua] – REMOVE EMITTER
Emitters[name].PTypes = nil
Emitters[name].PTypeIndex = nil
Emitters[name].PTypeSettings= nil
if Emitters[name] ~= nil then
if Emitters[name].numChildren ~= nil then
Emitters[name]:removeSelf()
end
end
Emitters[name] = nil
if debug then print ("–> Particles.DeleteEmitter(): DELETED EMITTER ‘"…name…"’") end[/lua]
Can anyone at X-Pressive verify that this doesn’t have any other adverse affects, and if so, can it be incorporated in a future build?
[import]uid: 6084 topic_id: 6479 reply_id: 306479[/import]