I know unity has a built in ‘Button’ system which has built in support for dead zones and sensitivity, and that when you start up the game, you can change the controls in the configuration dialog. However, I cant seem to figure out a way to change the controls at runtime - like so in a menu screen the user can select ‘change controls’ and pick what buttons they want.
Also, I noticed it’s possible to get the mouse position, mouse buttons, and keyboard keys independantly using GetKey and GetMouseButton, but I cant see a way to get information from a gamepad except by assigning a gamepad buton to a ‘Button’ and using ‘GetButton’.
Was wondering what other people did to get around this issue, or if its planned to have some handy functions like ‘AddButton(string, ButtonData), RemoveButton(string), GetButton(string, ButtonInfo)’ or something.
At this moment, unity does not expose the InputManager in scripting. You can request that feature here though.
Besides for that, there are not any ways to change the input besides using GetKey() with a string, and that has limitations that you mentioned above.
If you are building a standalone, then the dialogue that pops up before the game opens will let the user remap the keys, but at the moment, that is the extent of it.
@The OP: You can create an in-game control configuration menu, but it basically has to be done ‘from scratch’ (that is, you have to bypass the built-in input configuration system and replace it with your own).
There’s quite a bit of info on this available in the forums (try searching for ‘input configuration’ or ‘custom input’), but feel free to ask if you have any questions about how to implement such a system.
You could use a dictionary to match a key like “Jump” with a value like “w”.
Then you can change the Value of the dictionary value to whatever the user chooses.
Using a array would probably a bit more performant but a lot less friendly to develop with.