GMS 2 [SOLVED] Manually Setting Layer for Instance

Hi, there's a GMS2 bug which I am dealing with here. Here is the thread where this originated from. It's a year old so you can imagine I'm a bit peeved that it still hasn't been fixed either... Basically, when moving a persistent object between rooms, its layer value gets assigned to -1 (a depth layer) instead of it finding the layer of the matching depth. Which means instance_create_layer(x, y, layer, obj_whatever) doesn't work at all.

Supposedly I should be able to manually set the layer using this code, and work around the bug:
layer = layer_get_id("Instances");
But I can't get this to work. It still says -1, and the create code still won't work. It doesn't change the layer at all. I tried it in the room start even and now it's in the step event and it does nothing.

EDIT: Um... okay.

The documentation for layer_get_id says:
"Note that if you give the name of a layer that does not exist in the current room, then you will get an error and the project will crash." But then, it says that it will output:
"Layer ID Value (Real), or -1 if the layer specified doesn't exist"

So if it doesn't exit, it outputs -1? Or it crashes? Or what? I tested and it outputs -1, which may be my problem, but it seems like it should crash.

EDIT AGAIN: Solved this. It was dumb: I was just displaying the layer of the wrong object.

However, the persistent object changing room issue and the strange bit in the documentation still stand as things to have noted.
Last edited: