Like usual, I feel like I’m probably just overlooking something, but I can’t seem to find a way to get a Key struct reference from an input event. Is there a way to do this, or it just not exposed to Blueprint by default?
Side note: yes, I know I have both key events plugged into the GetKey node. That’s just for the screenshot.
What this method wants to have is a Input Event as a param.
You can use GetKey when you override the Input Functions OnKeyDown a.s.o.
These will give you the event struct and out of this you can call get key.
What do you want to achieve when you already know the key which is pressed?
Have you unchecked Context Sensitive to get that Method? just curious.
Edit:
If you want to use this this way, you could add a variable which is a Key Event (i believe it was called like that) and set it in a overriden OnKeyDown.
In your event you can now get this Key Event and call Get Key out of it.
Ideally, I’d like to expose the Key struct from an input event like Delta is exposed on Tick. The goal is a reusable function that isn’t affected by remapping keybinds.
The workaround I developed with some help from one of the Facebook groups employs Tick and the Input Action to open and close a gate if the Input Key is held, but that fires the entire logic chain every frame, which isn’t exactly an ideal scenario.
It’s starting to look like I’d have to mod source code to do this, and that’s where I start getting nervous.
Still digging around on this. I found the option to Add Call to Parent Function on the Tick node, but can’t seem to do that on InputAction mappings, or even direct InputButton nodes. Google is telling me “Oh yeah, you can totally just call to parent function,” but that doesn’t seem to be the case for input.
Well, since HeldTime has to be constantly updated, the dependence on Tick isn’t going away. Since Tick can only exist once in a graph, though, the need for access to the InputKeyEvent struct has become quite a pressing one. If anybody knows how I might go about exposing that struct reference on a custom InputAction node, we could be buds for life.
Current iteration, featuring some of Rama’s awesomeness: