x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

[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 .

Product Version: Not Selected
Tags:
more ▼

asked Mar 11 '14 at 05:41 AM in Everything Else

avatar image

ue4-archive ♦♦ STAFF
49.9k 3665 1991 9119

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

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

more ▼

answered Mar 11 '14 at 05:41 AM

avatar image

ue4-archive ♦♦ STAFF
49.9k 3665 1991 9119

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered Mar 11 '14 at 05:41 AM

avatar image

ue4-archive ♦♦ STAFF
49.9k 3665 1991 9119

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 05:41 AM

It is for a separate blueprint actor not a character blueprint.

avatar image ue4-archive ♦♦ STAFF Mar 11 '14 at 05:41 AM

I'm not sure if that is entirely possible within blueprint.

The actor you are trying to trigger input event at probably doesn't support InputComponent so it can't handle input events.

Moreover engine doesn't have any way of knowing that you want to trigger event on such actor.

In you character blueprint add event logic, and then add your target actor as object. In your target object creat function that will do, whatever you want to do. Then call that fuction within your character blueprint. Instead of character blueprint you could probably do it in level blueprint.

Other option would be to create delegate and call it on input event from either character or level blueprint.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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

then

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.

alt text

more ▼

answered Mar 11 '14 at 05:41 AM

avatar image

ue4-archive ♦♦ STAFF
49.9k 3665 1991 9119

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question