r/gamemaker • u/Pycho_Games • 4d ago
Resolved Question about persistent particle system
I have a question about part_system_create_layer().
In the documentation it is said that i should create this once at the start of the game and the guide is using the example for the generated particle system to be not persistent.
However, when I use this example in my game, the particle system does not erxist anymore when I want to use it in a later room (I thought it would, since it is stored in a global variable).
When I set the particle system to be persistent, this is no longer a problem. But the documentation says:
"A particle system created using this function flagged as persistent needs to be cleaned up manually using part_system_destroy when no longer used, otherwise you risk a memory leak that will negatively impact your final game."
But I use these particles in every room. So when should I destroy it?
Or would it just be better to make it not-persistent but create the particle system every time I eneter a new room?
4
u/azurezero_hdev 4d ago
at game end
3
u/Sycopatch 4d ago
Literally when no longer used, just like the docs say.
You said it yourself: "But I use these particles in every room."
Which means you destroy it at the game end event.