GMS 2 Instance Order In Layers is Glitched



Since updating to runtime v2.2.1.287 I've noticed somthing strange. (it also happens in 291..)
when deactivating/activating instances, they go back to the layer they were depending on their Creation Order! instead of their order inside the layer, and I've found no way to control it.
before deactivating:
after deactivating:
after activating:

the same happens when using layer_add_instance(layer, inst),
but what i found out was, it only happens when doing it in the same frame.
if you do it 1 instance per frame it's fine (the instance moves to the back of the layer).

I've attached some examples here feel free to mess with them:

can anyone relate?



If you want different draw orders. You need to use different layers. Or use an object that draw them in the order you want. Instances on the same layer can change execution order anytime. This is also true in 1.4. For most time it is the creation order, so people did not notice. But don't count on that.


Also, if you set the objects' depth to force their draw order, make sure the difference in depth is at least 1. Found that out the hard way when struggling with this same issue.


The point is we've built a whole game with tons of level relying on the order inside the layer and after updating the runtime bugs began to show up.. so yeah we could go through all the depth bugs but I believe it is necessary to suply one of the following:

- keep the instances in the order they were before deactivating them, I mean, in the begining of the room it was fine, why ruin it?

- or just to suply somthing like instance_bring_to_front(inst)

- or order the instances by the activate order and not by instance creation order

I want them to be in the same layer because otherwise I'd have to create a layer for every instance and it sucks..


keep the instances in the order they were before deactivating them, I mean, in the begining of the room it was fine, why ruin it?
It was not ruined. The feature you seek was never there in the first place.

From GMS2:
the only known order that will always occur in the same way no matter what belongs to the three step events and the different draw events. These will always remain consistent, so if you have code that relies on specific timing during each step of your game
From GMS1.4: gamemaker/events/index.html
It should also be noted that 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, which is subject to change as the software develops. However there are certain events that always run in the same order.
Last edited:


In html5 tho, and also in previous versions (runtime it works as expected, also, when you order instances in the room editor, the draw order is effected by the order they're placed inside the layer, am I the only one who think there's a problem?..
I guess I'll just report it as a bug and see what happens..