GameMaker Does Room End run before or after Clean Up?

matharoo

manualman
GameMaker Dev.
Let's say I change the room using room_goto(). After that, in what order are the Room End and Clean Up events executed for every instance in the room?
 
According to the GMS2 documentation section on event order, Clean Up and Room End events aren't guaranteed to run either before or after the other. It would likely be best to change up your approach -- especially if you're doing some sort of tutorial or course -- so that you don't have to fix it in the future.
 

matharoo

manualman
GameMaker Dev.
Add a show_debug_message() or show_message() to each event and find out? $:^ } (Or, step through code? Either way, easy to test.)

I hope this helps, $;^ J
Haha, right. Will do that.

According to the GMS2 documentation section on event order, Clean Up and Room End events aren't guaranteed to run either before or after the other.
Well, it doesn't say anything about the order when it comes to those two events. It has to be one way or the other, right? That is why I asked.
 
Well, it doesn't say anything about the order when it comes to those two events. It has to be one way or the other, right? That is why I asked.
That part was talking about which events are 100% guaranteed, across all runtimes past and future of GMS2 to run in that order. Anything else has the possibility of changing at a moment's notice because you're relying on GM's internals not changing for your code to be stable. Like the section I linked says,
the exact order that the events are going to occur in each step cannot be clearly stated, simply because it depends on the internal workings of GameMaker Studio 2 and this is subject to change as the software develops.
 

matharoo

manualman
GameMaker Dev.
That part was talking about which events are 100% guaranteed, across all runtimes past and future of GMS2 to run in that order. Anything else has the possibility of changing at a moment's notice because you're relying on GM's internals not changing for your code to be stable. Like the section I linked says,
Right. I was already trying to avoid depending on the order of those events, and now that it seems like there's no rigid order of their execution, I'll have to look for a different solution.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Clean up should be called after room end. The text for the clean up event pretty much says this:

"This event will be called after any event that removes an instance of the object from the room. So, it will be triggered if the instance is destroyed, if the room ends, or if the game ends"

PS: I'm with @ParodyKnaveBob in that you should test it and see! :p
 
Top