• 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!

Windows How do I deactivate all instances except for 2?

H1ghPuR

Member
Hey I am making a game with a pause system that makes it so that it deactivates everything using "Instance_deactivate_all()". I was wondering if there is a way to deactivate everything except for 2 objects because whenever you pause the game I want there to be an option to go to the main menu and an option to quit the game.

Here is a picture of the screen when you pause:
1628321164155.png

The bottom left button is to go to the menu and the bottom right is to quit the game, but those 2 buttons have no functionality since I deactivate everything.
 

Roderick

Member
When you create the buttons, store references to them in whatever is going to be calling instance_deactivate_all(). How exactly you do that depends on how you're creating the buttons.

Immediately after calling instance_deactivate_all() reactivate those two objects.
 

H1ghPuR

Member
Whenever I try reactivating those objects, it doesn't allow me to do it since they are deactivated: it says that it can't find those objects
 

Roderick

Member
It should work; the documentation even includes examples of deactivating a large group of objects and then immediately reactivating the ones you want to keep.

If you can't find the issue, consider trying instance_deactivate_region() instead.

And always remember Rule Number 1: Post Your Code.
We can't debug your code if we can't see it. Guessing what's wrong will only go so far.
 

H1ghPuR

Member
I found a different solution to the problem. I just created the 2 objects after deactivating everything so it works now. Thank you for the help.
 
Top