GMS 2 Number of elements returned by layer_get_all_elements is affected by the order of layers

pytong07

Member
I notice that the order of the layers affect the elements that are returned by "layer_get_all_elements".

code like this:
var layer_id = layer_get_id("my_layer");
var elements_in_layer = layer_get_all_elements(layer_id);

If place "my_layer" as the top most layer, I can get all elements in the layer.
If I place "my_layer" as the 2nd top most layer, I can only get a subset of the elements in the layer.
The lower the layer, the fewer elements are returned by "layer_get_all_elements" even though the number of elements are always the same in "my_layer".

Why is that?
 

TheouAegis

Member
Are the other layers treated as "sublayers"? If you move the one layer down, the sublayers could be moved up out of it, maybe. Seems wrong.

If this is 2.3, it could also just be yet another bug.
 

pytong07

Member
I have tried to keep the layers in a folder or move them outside of a folder, the count is still wrong as long as the layer is not the top-most later.
 
Top