GameMaker Persistent Objects' Layer Issue

K

Korbs

Guest
Hello,

I have two rooms, one is a duplicate of the other with the exact same layers (name and depth), just different contents. The first room has the player (persistent object) in the "Player" layer and the second room has the same "Player" layer without the player object.

I am testing by drawing the layer name beside the player, it shows "Player" on the first room but once i continue to the next room it shows "-1", it remains "-1" if I return to the first room too.

I have looked through forums and seen responses stating that when there is a room change, persistent objects in GMS 2 will set their layer to a layer with the same depth of the one it was originally created on. This doesn't seem to be happening for me.



Anyone have any idea why a persistent object would do this?

Thanks!
 
Last edited by a moderator:
K

Korbs

Guest
I made an empty persistent object and it produced the same result. It is created in the "Player" layer and once I change rooms it's layer becomes -1.

Also when I throw in the code "layer = layer_get_id("Player")" in the step event to constantly force these persistent objects into the Player layer (for testing) it acts strangely. When I do this the layer will be "Player" on the first room and stick to "Player" on the following rooms, but for whatever reason when I return to the first room the persistent object's layer's are set and stuck to -1 overriding my code until i go to other rooms...
 
K

Korbs

Guest
https://drive.google.com/file/d/0B2500so5lvjkWVc4dlJuQ25zYlE/view

Here's a video ^

The Text on the right is the layer, the text on the left is the depth, and the other text is just the rooms in each direction from the current one (ignore this). As you can see the depth remains unchanged and the layer becomes -1 and this is an issue as I can't spawn instances properly using a null layer.
 
M

MatteBlack

Guest
Has this been addressed or solved by YOYO? I keep seeing these posts with no answer.
 
Top