So I’m trying to simply change the input used for a button using the code below:
public InputActionReference triggerAction;
void Awake()
{
InputBinding binding = triggerAction.action.bindings[0];
binding.overridePath = "<Keyboard>/#(g)";
triggerAction.action.ApplyBindingOverride(0, binding);
}
I get no error messages at all with this code. However, it does not change the input to the letter G on the keyboard as it should. It literally does nothing.
I have now spent 4 hours trying a multitude of ways to get this to work. And nothing seems to do anything. This is really frustrating the hell out of me here considering how badly documented Unity’s new input system is.
Is my syntax incorrect somewhere? Or has this feature been broken recently?
edit: I also tried this, and it does nothing as well:
var test = controls.Cancel.ChangeBinding(0);
test.To(new InputBinding("<Keyboard>/#(g)"));
What Behavior have you choosen in Player Input?
I had a similiar problem, but I’m not sure, if my thread can help you: [New Inputsystem 1.0.2] Input uses "path" instead of "effectivePath"/"overridePath"
I’m using “Invoke C Sharp Events” and I needed to change the binding from the asset of the player.
1 Like
I’m not sure what you are asking me here. These controls are for the options screen scene and are all ran from one script attached to an object. I have both keyboard and gamepad inputs set up in my action maps.
I tried reading through your thread… but your scripts just have WAY too much info in them for me to follow along with. They are very detailed! 
Edit: WAIT! I think I get what you did differently and why it worked. You stored the input action asset into a variable and then edited that directly. Which seems to work on my end too! But this still makes no sense: why would this not work with the above code?
On a side note: My god, this input system is so counter-intuitive. There’s no way it can be called anywhere near a version 1.0.
1 Like