GMS 2 GMS1.4 -> GMS2 broken button behavior

bsabiston

Member
I imported my GMS 1.4 game to GMS 2 and boy it has not been smooth. One new issue I hit today:

I have a button, a persistent object at depth 0. When the player presses it, I change the depth to -100 to bring it above some other stuff. Later, when they press it again, I put the depth back to 0.

For some reason GMS2 doesn't like that. The button just seems to disappear when I set the depth back to zero. Its draw GUI function is no longer called. Anyone know why that would be? The button is still there, because I can click it. But it doesn't display. What does GMS 2 do differently that could cause this behavior, any ideas?

Thanks for any suggestions
 

arirish

Member
I don't use GM2, but from reading a lot of forum posts here, it seems like the depth/layer system is completely overhauled in GM2. It wouldn't surprise me if you need to change some of your functions. I'd check the manual.
 

NightFrost

Member
Anything there that might be obscuring it? Might be that the code conversion wasn't entirely successful and your depths aren't now working fully as intended, so something that wasn't obscuring it before, now is.
 

bsabiston

Member
There might be something obscuring it -- but would that cause the button's GUI draw function not to be called? The obscuring object has a custom draw function so I am not sure how GMS would know to not draw the button underneath. I can understand not being able to SEE the button, but I put a print statement in the draw function and it isn't even being called once I set the depth to 0.

I did read up a bit on the new layering system, but I don't know of anything that should cause the button's drawGUI function to not even be called. I'm not setting its 'visible' to false.
 

NightFrost

Member
There's also a limit of 16000 to -16000 to depth in GMS2, outside which draws will not execute, but that doesn't seem to be the case here as your problem occurs when setting depth to zero.
 
Top