It’s a well known fact that GameMaker: Studio 1.4 follows this order of events:
- Create Event of each instance
- Instance Creation Code of each instance
- Game Start Event (this will only be run in the very first room of the game)
- Room Creation Code
- Room Start Event of all instances
You can set the order in which specific instances are created within the room editor itself. But what about theRoom Start event of persistentinstances? Such instances are carried over from room to room. What if we have a room with another, newly created instance, that also executes a Room Start event?
room_01 room_02 obj_persistent -------->obj_persistent obj_new
I made a few tests and it seems that GameMaker, for this specific case, uses Depth. That is: the smaller/lower the depth value of theinstance, the sooner it will execute its Room Start event.
I’m talking about instances and not objects because if we change the instance’s depth via code, GameMaker will use that value, not the one defined inside the object editor.
Now jump into your code and have dozens of objects with different conflicting Room Start events (I’m kidding, please don’t)