How to change bindings for a specific inputactions

Hello, i wanted to know how to change bindings in the input action asset itself.

for example in my player actions there is a 2DVector and the WASD keys. i don’t want to save to json and load from json but changing the asset itself.

var action = actions["Movement"];
var composite = action.ChangeCompositeBinding("MovementBindings");

var up = composite.NextPartBinding("Up");
up.WithPath("<Keyboard>/upArrow");

// Or non-destructively with overrides.
action.ApplyBindingOverride(up.bindingIndex, "<Keyboard>/upArrow");
1 Like