• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!

GMS 2.3+ Order of code execution

Hello there.

I have a problem with order of code execution in objects. AFAIK, in GMS1 code runs "from first to last" object as they placed in asset tree. Say you have:
  • o_abc
  • o_def
  • o_hij
If you add to step "show_message(string(object_get_name(id)))" you get following: o_abc, o_def, o_hij
And if you manually move them in asset tree, order of execution WILL change.

But that not seems to be the case anymore in GMS2.3. From what i've seen it runs code in "from newest to oldest" order and seemingly absolutely cannot be changed.

Is that really so? Or i miss something important?

Please, tell me if im wrong and there is a way to affect this in GMS 2.3.


You should not base your logic on that order being consistent. Use the instance creation order section, or add checks to ensure code runs how you want it to.


Friendly Tyrant
Forum Staff
You have been relying on undocumented behaviour which is something you should never do as it will change at some point... The manual clearly states that you can't guarantee the order of execution except using the very clearly defined systems in place already in the IDe, eg: begin/step/end events, instance creation order in the room editor, etc...

Use the instance creation order section
You mean, in room editor? Yeah, that was the literally first thing i tried.
And yes, it affects order of code in "Create" event. Instances really are created in order how it was set in room editor.
Does not affect order of "Step" at all, it lives its own life.

Nice, thanks. So, a lot of rework should be done. Or revert to the old version to even finish the job. Thanks a lot.