[Question] Do key events work in class blueprint?
I am trying to create a blueprint for an actor that changes properties when you hold down the G key . I can a prototype of it to work in level blueprint , but when I try it as a class blueprint it will not register .
asked Mar 11 '14 at 05:41 AM in Everything Else
ue4-archive ♦♦ STAFF
PlayerController, Pawns, and LevelScript have input enabled on them by default. For any other Actor you need to either call EnableInput on it or change the properties to AutoReceiveInput
You mean actor you controlling or actor you retrieving trough trace ? We need more details to work out solution you need.
In any case you Open your Character Blueprint (assuming you have one) and in EventGraph add "InputKey G", then connect it the rest of graph that is responsible for action you want to trigger.
Using Your Own Casted Controller
You can just make a blueprint for your own custom controller, making sure that your game mode is using this custom controller
and then you can make functions either in C++ or the BP of your custom player controller to tell you about various inputs
in C++ it is WasInputKeyJustPressed or IsInputKeyDown
in blueprints you can make your own functions that utilize the KeyisPressed or KeyisReleased to set a boolean or other var to tell you info about the keys you want
in the blueprint you want to get the input data for, you cast to your custom controller and access the variables/functions that will give you the info you want!
Controller is responsible for handling input for the player so this model is actually quite appropriate, though it might take a few extra steps.
Follow this question
Once you sign in you will be able to subscribe for any updates here