Get the key value of an input action

Hi.

I want to create a system where it displays for example: [E] to interact with door
It differs depending on the item, which I’ve worked out using interfaces, but the E must adapt to whatever the player sets their input key as. How do I access the value of this input action and turn it into a string?

Thanks.

2 Likes

This is how you could get the key of a specific input action in a specific context:

2 Likes

Here’s another way:

21 Likes

Thanks!
This worked for me.

1 Like

It returns the key with the “0”, so if in Input Mapping Context you have first Input Action as mouse/keyboard and second as gamepad: just drag off from “key” → “is input key down” to make sure which was actully pressed.