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

Question - Code Recent depth changes?

Kyrieru

Member
After a recent GMS2 update, draw GUI stopped working for a specific object. After a while I realized it was due to me using;

depth = -1000000

It does not draw anything in the GUI event.

Ignoring the original reason for it, a depth of -1 does not have this effect. Obviously this is not much of a problem, but what caused that to happen in the recent updates?
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
This is something that is explained clearly in the manual on the page about layer depth, but appears to be missing from the page on the depth variable (I'll get it added)...

IMPORTANT! There is a minimum and maximum layer depth of -16000 to 16000. Anything placed on a layer outside that range will not be drawn although all events will still run as normal.
https://docs2.yoyogames.com/index.html?page=source/_build/3_scripting/4_gml_reference/instances/instance_variables/depth.html

Note that you can actually work around this by using "layer_force_draw_depth": https://docs2.yoyogames.com/index.html?page=source/_build/3_scripting/4_gml_reference/rooms/layers/layer_force_draw_depth.html
 

Hyomoto

Member
The question was already answered but I smell a strange behavior here. If you are using the draw GUI event, you are already drawing on top of the entire draw pipeline, and you still have begin, normal and end events. It seems like -100000 is being chosen here rather arbitrarily, though if it isn't I would suggest reading about new depth ordering paradigms in GML as the old depth methods from GMS1 and prior are not great options.

https://forum.yoyogames.com/index.php?threads/depth-ordering-in-gms2-priority-list-nested-list-grid-binary-list.13425/#post-88283
 

Kyrieru

Member
Yeah, wasn't too worried about using-1000000 was just an arbitrary number I used. Good to know it's just a hard limit doing it.

Though what I don't get is why it didn't happen before, if it was already in the manual.
 

Yal

šŸ§ *penguin noises*
GMC Elder
Is the -16000 / 16000 range enforced or warned about somehow when importing a legacy project, or is the only way to know if there's bugs caused by this to check every object's default depth?
 
Top