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"

How to detect which action key has been pressed? [C++ or Blueprint]

Hello everyone,

I made an inventory system for my game but I want players to be able to do fast switching by pressing the buttons from 1 to 9. I defined an action input and put 9 keys in that action input. Basically, the same function will be called from those keys; however, I need to detect which key has been pressed, so that I can select an item from the inventory. How can I detect the key which has been pressed? Or can I get the index of the key? A solution in both blueprint or C++ is okay.

I'm thinking of defining 9 action inputs but it doesn't look like the best way to do, and also I can't block pressing multiple keys by doing that, I guess. "If statements" at the beginning of the functions may not be adequate?

Product Version: UE 4.20
more ▼

asked Dec 09 '18 at 01:50 PM in C++ Programming

avatar image

70 2 3 7

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

0 answers: sort voted first
Be the first one to answer this question
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