You receive this error because you remove particle before it receives all the messages.
I am using the next code for removing particlefx:
go.property("path", msg.url("#particle_fx"))
go.property("need_to_remove", 1)
local function particle_callback(self, particlefx_url, emitter_id, state)
if state == particlefx.EMITTER_STATE_PRESPAWN then
self.counter = self.counter + 1 -- count how many emitters start working
elseif state == particlefx.EMITTER_STATE_SLEEPING then
self.counter = self.counter - 1 -- when the last emitter is sleeping remove GO
if self.counter == 0 then
go.delete(".")
end
end
end
function init(self)
self.counter = 0
if self.need_to_remove == 1 then
particlefx.play(self.path, particle_callback)
else
particlefx.play(self.path)
end
end
This is still an issue. In my game itās not ideal to leave the game object deletion to the particle callback.
Is there a different workaround to avoid the "ERROR:GAMESYS: Could not run particlefx callback because the instance has been deleted." error? Removing the callback when the game object is deleted could work, but I donāt think thatās possible now?
We should fix this. Can I please ask of you to create a small sample project and create a ticket for this issue and Iāll promise to fix the check and stop spamming the console if the pfx has been deleted.