• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - IDE Cleanup event - when this was added?

gnysek

Member
I've just noticed "Clean up" event in objects, which seems to be very, very useful (it's a better version of "on destroy"). Was this added in 2.0.6, or was before and I was so blind to not notice this for two months?
 
I've just noticed "Clean up" event in objects, which seems to be very, very useful (it's a better version of "on destroy"). Was this added in 2.0.6, or was before and I was so blind to not notice this for two months?
Might be time to go to the optomitrist and get your glasses rechecked. :) It was definitely in earlier releases.
 

TheMagician

Member
Can someone give me an example of how this event improves on the Destroy Event?
Even after reading the manual it seems to me like it is triggered in the same instances where the Destroy Event would already be called.
 

gnysek

Member
Can someone give me an example of how this event improves on the Destroy Event?
Even after reading the manual it seems to me like it is triggered in the same instances where the Destroy Event would already be called.
On Room End / Game End, instance_destroy() isn't called. Also, clean event would "probably" also work on deactivated instances.
 
K

Kuro

Guest
I've just noticed "Clean up" event in objects, which seems to be very, very useful (it's a better version of "on destroy"). Was this added in 2.0.6, or was before and I was so blind to not notice this for two months?
Might be time to go to the optomitrist and get your glasses rechecked. :) It was definitely in earlier releases.
Gnysek, since it appears that you have the Godlike power to discover brand new features and then bend reality so that they have been there all along... if I send you a short list of features please would you look for them in the current build for me? xD
 
K

Kuro

Guest
So I should switch to using the clean up event instead of Game End for cleaning up my data structures?
 

gnysek

Member
So I should switch to using the clean up event instead of Game End for cleaning up my data structures?
If your object is not persistent, the yes, as this event won't be called if instance doesn't exists! Btw. if game is closing, then Windows will automatically clean all memory, so you don't need to clean on game end - only in mid-game when something isn't needed anymore.
But "clean up" is the safest in all cases - you know it always be called on destroy :)
 
You don't need to clean up anything on game end.
While this is true, I would still recommend manually ensuring everything is cleaned up, just in case you change your code logic, or how you restart your game, or anything like that. Being lax about cleaning up after your dynamic resources can lead to nasty memory leaks later down the line, and its really easy to do if you've been just letting the OS clean up after you.
 
Top