Disabling all instance and then re-enabling

Hello,

I use to work in gamemaker and have decided to move over to unity.
In gamemaker there is the ability to disable an instance so it stops running, its variables can also be accessed when it is inactive.
This is also possible in unity with the active = true/false.
My question is, in gamemaker it is psossible to re-activate all objects within an area.

https://manual.yoyogames.com/GameMaker_Language/GML_Reference/Asset_Management/Instances/Deactivating_Instances/instance_activate_region.htm

Does unity have something similar?

In gamemaker I had over 100 000 objects in the game but 99% were de-activated at 1 time.
Just trying to re-create something similar.

Thanks,

Make them under the same parent then disable the parent?

2 Likes

If you really want to be area-specific, you might want to check out Overlap functions in Physics (and Physics2D depending on your needs).

in 3D
OverlapBox
OverlapCapsule
OverlapSphere

in 2D
OverlapArea
OverlapBox
OverlapCapsule
OverlapCircle
etc

and variants thereof will all interact with object colliders and tell you which objects you should care about in optimal time. then, once you have this list, it’s pretty trivial to go through them and set their status via SetActive.

according to your example, OverlapAreaAll would be the closest analog.
also be mindful of the following sentence in the docs