Problems with CombatLevel not being able to access the PauseMenu input.


Author: Carlos Reid

Posted on: 03/21/2025

Problem:

While testing our combat level.  I noticed that pressing P to open the pause menu wasn’t doing anything. The same pause system worked fine in every other level, but just not in the combat scene. Comparing other maps in our game to the combat map, I realized that almost every map in our game had one thing in common, it was that they all used the CodeGameMode.


 In contrast, the combat map was the only one that used a different game mode called the BattleGameMode. 


All levels that used the CodeGameMode had BP_Player set as the default pawn (which uses input to access the pause menu). 


In contrast, the combat level uses a default pawn BasePlayer which doesnt use any input. 


This explains why the pause menu didn't work because the input was tied to the Enhanced Input System inside BP_Player. Since BP_Player wasn't spawned then pause input was never set up in the combat map. The input to access the pause menu now works, but this arose another issue as well. When spawning in the player now it also spawns in the PlayerHUD. So, there was two different HUD's active at the same time because the combat map has its own HUD.




Solution:

For the input problem, I changed the default pawn from DefaultPawn to BP_Player. Now that there is an active player in the level you can use the input to activate the pause menu.


 For the PlayerHUD problem, I removed the reference and binding of the PlayerHUD inside the player and moved it over to the CodeGameMode. 


Now when you are on levels with the CodeGameMode, the PlayerHUD will take priority.


 When you are in the combat map using the BattleGameMode, the CombatHUD will get prioritized.


 To summarize, the main solutions were to set the default pawn to BP_Player and shifting the responsibility of the HUD creation into the GameMode's. There were many problems that have arisen during last week's sprint, but this one was definitely the most thought provoking and recent. There are still hurdles I must get over with this such as possibly removing the BattleGameMode's HUD when accessing the PauseMenu. However, the problems with this have been solved for now.

Get Relicbourne

Leave a comment

Log in with itch.io to leave a comment.