I have a game with a Pawn (ABall) and a HUD (ABallGameHUD). When the game is running, I press the Escape key, which should open a pause menu UI and set the input mode to UI only. However, when I press the Escape key again to close the UI, the input handling results in both the Pawn and HUD class functions being executed simultaneously. This unintended behavior disrupts the expected flow of pausing and unpausing the game.
Attempts to Resolve:
I’ve tried various solutions, including introducing state management, using boolean flags to track the UI’s open/closed state, and modifying the input handling in both classes. However, none of these attempts have successfully resolved the issue.
Desired Outcome:
I’m looking for guidance on how to handle the input and UI interaction properly to ensure that pressing the Escape key:
Opens the pause menu UI.
Sets the input mode to UI only.
Closes the UI.
Restores the input mode to the game.
Ensures that only one class handles the input and UI actions at any given time, preventing simultaneous execution.
Additional Information:
Both my classes, ABall and ABallGameHUD, are involved in handling input and UI interactions, and I need a structured approach to manage these actions effectively without conflicts.