Gamemode.h Blueprint keyboard input to quit gamemode
I have tried to build something into my gamemode, so that when I press "Escape" the game shuts down. The script I built is very simple, and shown below.
The thing is the breakpoint is never hit when I press the button. I have tried a working keyboard input, which works in my character blueprint.
It strikes me that because the Gamemode Blueprint inherits from Gamemode.h much of the input doesn't work, for example "Enable Input" can't be dragged into the Gamemode blueprint?
What is the correct way of getting this to work? Have the character flag that the end is nigh and then the game mode shutdown based on the character?
I have checked the defaults and believe that the Gamemode blueprint is pointing at the Playercontroller, yet still no input routes through to the Blueprint:
asked Sep 24 '14 at 09:37 AM in Blueprint Scripting
To enable input in the GameMode BP, you'll first need to Get Player Controller and then drag off that to find the Enable Input node. If you do that on Event Begin Play, your GameMode will be able to accept your InputAction Quit.
It is generally bad practice to have any input going through your GameMode if not necessary, though it is possible. Instead, you could set this up in your Player Controller or in your HUD.
Hope that helps!
answered Sep 24 '14 at 06:53 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here