I’m trying to make an app that can detect what key or button is pressed then show that button or key in a UI text field.
I am NOT trying to detect a specific key or button as in Input.GetButtonDown(keycode.space).
This is trying to detect if space key is pressed. And when I search for help on this, this is what I usually find.
But I want when a button is pressed on a controller or keyboard to be detected then stored.
I apologize if there’s a thread on this already, but I did search before making this one. And I didn’t find the help specific to what I was looking for.
If more information is required to help me with this, please let me know. Thanks in advance.
I have come across this in the unity docs before and wasn’t sure if it only detects keyboard input. I will also need to detect input from controllers as well. But I will try implementing this when I get home.
I mean, sure, e.isKey checks for whether it’s a keyboard key. There is also isMouse, and you can check the specific Event Type (like MouseUp, MouseDown, Drag, …). Sadly i’m not familiar with working with controllers.
Yeah in the end the consensus is that there’s no direct way to detect game pad input. And after searching all night, that’s the thread I ended up on. In the end I went with Marrt’s suggestion. Seemed to be the neatest way of doing it.