GMS 2 Instance Order In Layers is Glitched

T

Trasoside

Guest
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.
example:
before deactivating:
upload_2018-12-22_14-51-16.png
after deactivating:
upload_2018-12-22_14-51-28.png
after activating:
upload_2018-12-22_14-51-39.png

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:
https://www.dropbox.com/s/ugi7uk0c59p7rmp/testlayerdepths.rar?dl=0

can anyone relate?
 

Attachments

The-any-Key

Member
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.
 
M

McKayB

Guest
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.
 
T

Trasoside

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

The-any-Key

Member
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: https://docs2.yoyogames.com/index.html?page=source/_build/index.html
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: https://docs.yoyogames.com/source/dadiospice/000_using 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:
T

Trasoside

Guest
In html5 tho, and also in previous versions (runtime 2.2.0.261) 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..
 
Top