To keep my C2 code simple, clean, and easy to read, I like to put ALL my code into Groups. When an event in that Group is resolved I deactivate it and activate the next one. Sometimes I have to leave a Group open until events have resolved... This FSM-style methodology works very well for me but I ran into an obscure bug recently and I'm wondering about the best way to prevent this problem in the future.
My issue occurred when I switched to a new layout and then back again. I expected the layout to basically "restart" but I apparently had a Group open (from before) and that code was executing out of order. Anyone else run into this? I don't think there's a programmatic way to Activate or Deactivate all groups, right? I could do it on a Group-by-Group basis but I have a lot of Groups.