Anonymous
8/22/2025, 11:49:10 PM
No.536277563
I'm running into a problem with my game manager. I update my game state from other scripts and it creates bugs.
For example I tell my game manager to go back to the gameplay state after a menu closes. If I turn off menu A immediately after after menu B opens, the game state will be set to gameplay instead of menu B.
I thought of removing the ability to update the game state from other classes, add references to other classes in the game manager and let the game manager update its game state itself but that seems really messy.
I could modify the script execution order but that's messy as well. Is there a programming pattern to fix this?
For example I tell my game manager to go back to the gameplay state after a menu closes. If I turn off menu A immediately after after menu B opens, the game state will be set to gameplay instead of menu B.
I thought of removing the ability to update the game state from other classes, add references to other classes in the game manager and let the game manager update its game state itself but that seems really messy.
I could modify the script execution order but that's messy as well. Is there a programming pattern to fix this?