Kealor
Member
I am having a very unique issue that appears to be specific to my project, but appears to be a bug in GMS2 as far as i can tell.
I have two layers of concern: "Tiles_arena_platforms" and "Tiles_foreground_top". My aim is to based on a bool, make the former visible/invisible. sounds simple enough and i have this code:
Now the instance activates/deactivates work perfectly as needed, so i should expect the layer visibility to as well, but it doesnt. Instead of "layer_set_visible("Tiles_arena_platforms",0);" applying to the correct layer, it applies to "Tiles_foreground_top" instead!
I have tested this with many different names, layers, rooms, objects and i get the same occurence every time. I do not get the same error in a new project.
This suggest that it is something in my project causing this. However i dont believe it to be a fault in my code, or atleast a rational, acceptable one. I have read out the data returned by "layer_get_all" and every layer that is supposed to exist at this time does, and in the correct order (appended at the end). The layer room target is reset at this point and it is verified that this is uniform with layer_get_visible as it appears to be returning bugged results in other areas also.
If anything can be thought of to fix this issue it would be greatly appreciated, i cannot imagine why the system for determining layer ID based on name would return completely unreliable results.
Cheers for any help!
PS: One thing ive been wanting for a while is a function/variable to determine the current draw layer and/or depth (not the layer/depth of the current object, i mean the depth/layer in engine being processed). I believe this should be possible 99% of the time and would be extreeeemely useful when it comes to layer_set_script_begin/layer_set_script_end in setting the variables for shaders. There is a way to get this data by setting up a system of layer indeces and number of times a script has run, but that is overly complex and takes up valuable processing time just to determine a value that allready exists in memory.
Layers in the room:
layer_get_all data and the code used to read it out:
I have two layers of concern: "Tiles_arena_platforms" and "Tiles_foreground_top". My aim is to based on a bool, make the former visible/invisible. sounds simple enough and i have this code:
Code:
switch arenaStats[7]
{
case false:
instance_deactivate_object(objPlatformParent);
layer_set_visible("Tiles_arena_platforms",0);
break;
case true:
instance_activate_object(objPlatformParent);
layer_set_visible("Tiles_arena_platforms",1);
break;
}
I have tested this with many different names, layers, rooms, objects and i get the same occurence every time. I do not get the same error in a new project.
This suggest that it is something in my project causing this. However i dont believe it to be a fault in my code, or atleast a rational, acceptable one. I have read out the data returned by "layer_get_all" and every layer that is supposed to exist at this time does, and in the correct order (appended at the end). The layer room target is reset at this point and it is verified that this is uniform with layer_get_visible as it appears to be returning bugged results in other areas also.
If anything can be thought of to fix this issue it would be greatly appreciated, i cannot imagine why the system for determining layer ID based on name would return completely unreliable results.
Cheers for any help!
PS: One thing ive been wanting for a while is a function/variable to determine the current draw layer and/or depth (not the layer/depth of the current object, i mean the depth/layer in engine being processed). I believe this should be possible 99% of the time and would be extreeeemely useful when it comes to layer_set_script_begin/layer_set_script_end in setting the variables for shaders. There is a way to get this data by setting up a system of layer indeces and number of times a script has run, but that is overly complex and takes up valuable processing time just to determine a value that allready exists in memory.
Layers in the room:
layer_get_all data and the code used to read it out:
559
lay_technicals
560
lay_blocks
690
Controllers
561
Tiles_foreground_top
562
Tiles_foreground_c
563
Tiles_Col_Occ_foreground_b
564
Tiles_foreground_a
565
lay_lights
566
lay_player
567
lay_entities
568
lay_interactables
569
lay_effects_1
570
Tiles_arena_platforms
571
Tiles_arena_hookPoints
572
Tiles_background_d
573
Tiles_background_c
689
lay_effects1
574
Tiles_background_b
575
Tiles_background_a
lay_technicals
560
lay_blocks
690
Controllers
561
Tiles_foreground_top
562
Tiles_foreground_c
563
Tiles_Col_Occ_foreground_b
564
Tiles_foreground_a
565
lay_lights
566
lay_player
567
lay_entities
568
lay_interactables
569
lay_effects_1
570
Tiles_arena_platforms
571
Tiles_arena_hookPoints
572
Tiles_background_d
573
Tiles_background_c
689
lay_effects1
574
Tiles_background_b
575
Tiles_background_a
Code:
var allLayers = layer_get_all();
for(var i = 0; i < array_length_1d(allLayers); i++)
{
show_debug_message(allLayers[i]);
show_debug_message(layer_get_name(allLayers[i]));
}