• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker instance_deactivate_all is inconsistent?

JAG

Member
Has anyone ever run into an issue where they call instance_deactivate_all(true), and it works sometimes but not others?

I have the debugger running. Ive set a breakpoint where Im calling the function in an object user_event. I then have set a breakpoint at the beginning of the Step event for the same object, which will run on the next frame (because user events are resolved after Step). Im then testing by triggering the user_event in my game, which stops at the break point, then pushing continue to hit the Step event -- I watch the "All Instances" tab to see whats happening with the objects in my room.

Here's the weird part:
SOMETIMES when I hit the second breakpoint only the calling object is listed in the Instances tab, which is correct. But more frequently the Instances tab shows ALL my objects -- which either means that they were never deactivated in the first place, or something between event_user and the next frame's Step event re-activated everything.

Ive checked my code and Im definitely not calling instance_activate_all anywhere in this room, and even if I were I would expect the behaviour to be consistent. Does anyone have any theories about what might be going on here??

Thanks!
 

JAG

Member
Thanks @Simon Gust Im not sure how I would do that in this case? Im calling the function and the objects never become deactivated. I can unpause the debugger and the game objects are all still active, it's very strange

Update: I am developing on a Mac so tried the code out on my PC -- the buggy behaviour does not exist on the PC, which leads me to believe this is a GMS2 Mac bug. I'll submit a bug report I guess? Not sure how to resolve the issue...
 
Last edited:

Simon Gust

Member
Try
Code:
instance_deactivate_region(0, 0, room_width, room_height, true, true);
or
Code:
with (all)
{
   instance_deactivate_object(id);
}
or
Code:
instance_deactivate_object(all);
 

JAG

Member
@Simon Gust Im gonna be honest I thought you were crazy to suggest these things, because how would they not be synonymous with instance_deactivate_all under the hood, right? WRONG! Both of your latter two suggestions work perfectly (didn't try the first). WTF!??

I really love gamemaker, but when something like this happens and I waste 2 hours trying to figure out what Ive done wrong, and it turns out to be a bad GM bug like this I get very upset. Oh well, moving on.

Thanks again!!
 

ctrl-JC

Member
It's 2024 and I think this bug is still present. I'm developing on a PC, so I guess it's not just a Mac bug.

I tried
GML:
instance_deactivate_object(all);
instance_activate_object(self);
and I can confirm it works perfectly.
 
Top