• 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.

GMS 2 What is the order of execution in GameMaker Studio?




I'm relatively new to GMS, I am working on a small project and now I'm experiencing a weird error and I can't figure out what is causing it.
I believe it got something to do with the order of execution under the hood in GMS.

The story:
I'm using GMS2 and GML. I have created a Game room and setup the entire game in this room. No problem there, the game runs fine. Next I have created a new room just below the Game room only to use it as a Game Over screen.
If you lost or win the game, it go to the End room and simply ask you to press enter to start the game again and if you press enter it does go back to the Game room and the game start all over again. No problem with that, it works fine. Now the weird part. I figured, okay I create a room above the Game room to display a menu only to start the game room, nothing fancy only asking the player to press enter to start the game. If the player press enter, it supposed to go to the Game room but it does not work.

What happens is, when I press enter in the Menu room, it does go to the Game room but then immediately jump to the End room. It is obviously got something to do with the logic I created when to go to the End room from the Game room. So I was playing around with it but could not figure out what the problem is. As a final thing to try I have commented out the entire code that ends the game and go to the End room. Now if I press enter in the menu room, the game do start up but instances are not being created in the room and I have no clue why. The instance supposed to be created in the Create event of the GameController which is added to the Game room, so when the Game room starts why the Create event doesn't get executed and why the instances are not being created?

Of course I don't expect anyone to be able to help me without looking at the actual project. I suspect, it got something to do with the order things are executed in GMS under the hood.
Could anyone list the order of execution please?


1. Room create
2. Create instances of object
3. Run Create event of instances
4. Run room create code
5. run Step event of all instances.

Something like this, the more detailed the better. I'm hoping if I know the order in more detail then maybe I can figure out what is wrong.
Or in case someone did experienced a similar problem, what was the problem?

I would appreciate any help.
Thanks in advance.
Last edited by a moderator:


you know you can answer that question yourself ?^^ (I don't even remember it myself by heart; just the weird fact that room creation is run after the instance creation code; cause most of the time I do it wrong and end with a bug there :D)

just create a new project with an empty room and a dummy object in it with and put show_debug_message("name of event you are testing here")
eand just read the resulting order in the log console.


Thanks. show_debug_message worked. The problem was that I used an invalid layer name when I was creating instances. It worked as long it was the first room (don't know why....), but in case it was the second, it thrown an error and that is why the instances was not created and it caused all the problems I had :p
Last edited by a moderator: