• Hey! Guest! The 39th GMC Jam will take place between November 26th, 12:00 UTC and November 30th, 12:00 UTC. Why not join in! Click here to find out more!
  • 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 Draw Events Not Happening


Hi, I have a long standing project I recently moved from GMS 1.4 to GMS 2, and although the transition has been very clean, (props to the GMS 2 dev team on that one,) I came across what I’m thinking is a bug in GMS 2. My game is a top down game, where I am shifting the depth of the instances in the game based on their Y position. I’m sure you’ve all seen a similar technique done a million times, which made me surprised I only found one post about a similar bug.

So what’s actually happening? When the depth is shifted higher, (and further down on the managed layers,) sometimes all the draw events other than the main one will just not happen. If I disable my depth shifting, it doesn’t happen. As you can see in this gif of my game, the HUD, which is drawn on the End Draw event, will not draw. I’ve tested to make sure the entire event is in fact just not happening. Although I don’t know the direct cause, I do know that it’s affected by multiple instances going to the same depth. As you can see in the gif, I have 30 other creatures in the zone to the right, and those creatures have weapons (their heads) that can shift depth as well. Although they can shift their depth as well, they have not, due to not moving. If there are no other depth shifting instances (creatures and weapons) in a room, this bug will not happen, (though it will still happen if the creatures were there, then were destroyed due to dying). Although it’s easy to reproduce the bug, I have not yet figured out the specific cause. Haven’t seen any real patterns in the depth of the various instances, other than the fact that, when it does happen, the bug only activates when I move upward, which causes the depth value to increase.

So what the heck? Does anyone know anything about this bug? Is there some pitfall I may have missed when it comes to how depth is handled in GMS 2? I know that GMS 2 now has layers, which are preferred to depth, but depth isn’t deprecated, and mostly still works the same. I’ll be happy to report the bug on proper channels if it’s not already known.