Unable to disable player keyboard input when widget is in viewport

Hi,

I’ve recently noticed I could open the Pause Menu widget while the Loading screen widget was in the viewport.

Going into the Loading widget, I implemented a simple disable input, but I’m not sure why it isn’t working. It still responds normally when I hit the pause button and the menu appears.

  1. When the Loading widget is initialized it should immediately disable player input but it doesn’t

  2. Clicking the pause key still works (this is in the player BP)

The alternative is to check if the loading widget is visible from the player BP and if it is then the pause menu can’t open, if loading screen isn’t visible, pause menu can appear but I can’t work out how to do the reference properly?..

1 Like

Is your player a Pawn class or a Character class?

Loading screen

Are we just showing a widget or actually loading a new level? What are the chances the player gets destroyed and a new instance is spawned? That brand new instance would have input enabled by default.

1 Like

You make me think that because the player technically doesn’t exist yet until after the loading screen is done or very nearly done it’s not working. Is there a way to disable input regardless of the player existing?

re: Character class I believe, we are showing a widget while the level loads and spawns the player

This might be important. Do double check in the upper right corner of the player blueprint:

image

image

If your player is a simple Pawn, this will not work. Best plug Get Player Pawn here. A character inherits from it anyway.

You make me think that because the player technically doesn’t exist yet until after the loading screen is done or very nearly done it’s not working.

If there’s no player, we can’t disable its input. Do isValid up there - see what you get.


You could also try:

Removing Context Mapping, and only add it once you’re ready (the game has loaded what’s needed). That should be done outside of a class that might get destroyed.


Or you could disable input in the player BP by default. And only enable it when it’s game time.

1 Like

Okay, so the player parent class is Player Base and the Parent class of Player Base is Character.

I’ve tried using both Get Player Character and Get Player Pawn but neither worked. I’ve also tried the following but that also doesn’t work, and I wasn’t sure how to implement something similar in the player itself and where I could enable input/add mapping context again