Does Keyboard Input Work In The GameMode Blueprint?

In gamemode blueprint I added keyboard input (Z key) and I added a “print string” which is connected to it. In game when I press Z nothing happens. I want to print a variable to the screen when I press Z.

1 Like

from what i know and have seen no keyboard input events cannot be used from the game mode. actually if you ahve context sensitivity on you cant event find keyboard inputs. you would be better off having your input call an event in the gamemode or implement a interface. personally i believe you should try too keep all input events in one location (such as the player controller) as it makes things much simpler. theres nothing worse than trying to test some functionality and it not working due to the same input being used somewhere else that you dont remember.

i imagine the reasons that you cant do input in the game mode is because you can have many player controllers in one game and because you can have a game mode but no player controller. logically you need a player controller for input as its the interface between the player and the game.

1 Like

Okay I get it. But I have one more issue with keyboard inputs. I can’t make keyboard inputs work in any blueprint. I am trying the most simple code I know with keyboard inputs but it doesn’t work. I tried this in level blueprint, player controller blueprint, player character blueprint. When I press A nothing happens.

252443-8888.png

in most blueprints you need to allow input. one way to do this is to click the class defaults button near the top then in the details panel look for the input section, there look for auto receive input and set it to player 0. the level bp and player contoller should allow input by default but you need to ensure that you have the right player controller set to be used in the game mode bp. to check the defaults for use in the game mode open the projects settings via edit → project settings, then look for maps and modes on the left and click it.

beyond those cases its dependent on your project. theres things like paused games and set input mode which can override other settings. also if you use the same keyboard event in many blueprints it could lead to some blueprints taking priority.

1 Like