• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Issues With Particle Emitters

TravsVoid

Member
I was debugging my project and one of the issues I came across involved the wrong particle emitters be destroyed. In my particle setup I created a single global particle system, I created multiple global particle types, and then I create an instance emitter in certain objects. Using the part_emitter_exists function I would check if the emitter exists when I destroy the object and if it does I used the part_emitter_destroy function to destroy the emitter. But for some reason the exists function will say an emitter exists when it doesn't and when deleting this emitter it will delete an emitter that does exist but it's not the one I'm actually calling to be destroyed. I created a sample project to see if I could replicate my issue and I actually could.
 
Last edited:

TsukaYuriko

☄️
Forum Staff
Moderator
Emitter IDs are re-used after you destroy them, so when you destroy an emitter, set the variable that referenced it to -1 so it becomes an invalid emitter ID. Otherwise, this happens.
 

TravsVoid

Member
Emitter IDs are re-used after you destroy them, so when you destroy an emitter, set the variable that referenced it to -1 so it becomes an invalid emitter ID. Otherwise, this happens.
Thanks this solved my issue. Is this information about emitters in the manual?
 
Top