How do I pause and resume scene collections in UPBGE using Python?

I have a pause menu, and I want the player to be able to pause the game, but I cannot get all the collections to ‘pause’ by suspending them. The idea is to use Python to check for all Collections and exclude the collection named ‘Pause’. If a HUD is in the scene’s collection, it will try to remove that overlay collection. It will also add the overlay Pause collection, and all other objects are suspended until the player clicks on Resume, in which the pause menu collection is removed and every collection resumes.

I’ve already done the majority of this, but the collections do not freeze upon the Enter key being hit, as I do not know how to make all collections on a scene freeze/resume.

I already tried to change the collection actuator with a for loop to suspend every collection in the game, but apparently the collection variable on the actuator is read only.

You can try creating a message listener to activate and deactivate all collections (basically it means that you need to create an collection actuator to disable and enable every single collection). It’s annoying, but probably works.

And first, test this method with only one collection to see if it works as you want, if does, do with the rest.

Why not in the next UPBGE version, make the collection variable read/write rather than read-only? And when you print(dir(collection actuator name)), it prints out the actual variables (like Collection, Camera, SuspendLogic, SuspendPhysics), etc? Just some feedback for making UPBGE pause menus easier.