- Home /
Change WADS to custom Keys through script
I am wonder if it is possible to change the input keys used from their default WADS setting to new custom keys through code rather then using the input manager. If so how can I accomplish this?
$$anonymous$$ake your own inputs... In Unity:
Edit
Project Settings
Input
Check out Unity has it, but make it for your own (Name your axis and what not).
Should help out.
@Justin Warner: That's still done through the Input $$anonymous$$anager and does not help because that's what the op is trying to avoid.
Answer by skovacs1 · Dec 10, 2010 at 05:12 PM
No. I do not believe that you can change the virtual buttons defined in the Input Manager through code. You would have to either change them in the Input Manager in the editor, provide the Configuration Dialog or define your own setups using the specific keys, etc.
One way to do your own setup for configurable buttons or axes is to define an Enum or array of key identifiers which somehow(your choice) map to the key names used by GetKey and then store the key string in a variable whenever you set it and when checking input, use Input.GetKey(keyString). Wherever in code that you need to change the key, you merely change this string variable and it just works. This is essentially a virtual button and you can setup all sorts of other settings for damping and sensitivity and whatever to emulate GetButton or GetAxis as you need, with the exception of Input Axes not defined by keys, which would have to be retrieved by button name.
Another option is to have several different buttons/axes defined in the Input Manager with different names. By controlling the value of a button/axis string in much the same way as above, you can change which Button or Axis that you want to use by simply changing the value of the string, Input.GetButton(buttonString); Input.GetAxis(axisString); and such.
True, I was hoping this was possible but the more I think about it and review it I don't think it actually is. Thanks for your answer
Answer by danielpaavola · Nov 22, 2015 at 05:50 PM
I'm not sure, so don't take my word for it, but I think you may be able to just make a different axis and just set the keys up differently and switch between the two axis.
I've been working on making this work, but so far, I can't.