I’ve been working to migrate my game to the new Input system in order to have the ability to allow the players to Rebind all all the controls in my game, including existing axis(Vertical, Horizontal, ect…)
I’ve created my Input actions and configured them they way I believe they need to be configured.
That all works as I would expect, However when I Rebind the controls Using the “Rebind Action UI” script (Transplanted into my project from the “Rebinding UI” Sample) the “ActionBindingText” Updates with the new controls but my Existing ‘InputMaster’ Objects still only respond to the original controls. This is my primary issue right now.
My end goal is to allow users to rebind controls and have those controls persist across plays (and between closing and reopening the game.)
The secondary issue I am having is that I have no idea how to “Save” the binds once they are set but I am assuming I’ll need to save off the .asset JSON and load based on the saved JSON. Is that the correct line of thinking?
I’ve been banging my head against this for quite awhile and I would appreciate any help you can provide.
Thanks
-Zachari Barnes
I am having the same issue at the moment. I am using the RebindActionUI script from the sample, and it is updating the labels for the bindings, but the Actions and Bindings never seem to be modified. It is the same for the sample scene in the sample.
I’ve been throwing in debug strings and when I throw them in OnActionChange in RebindActionUI.cs to try and expose the name for the action, I get null reference errors.
I made a control scheme but that broke more things in my game and didnt fix the rebind not applying the override. Poking around the RebindActionUI.cs file i tried to find a place to plug in ApplyBindingOverride() but i can’t get all the info i need to pass along. Any one been able to figure this out?
So, one general thing, with the C# generated wrappers, control schemes won’t do anything except with additional scripting. This is a gotcha that has caught many users unawares and something I would urgently like to have fixed after 1.0. Basically, whereas PlayerInput automatically takes care of device pairing and control scheme selection, you get none of this ATM with generated C# wrappers. Means that all bindings are active no matter what. You need to manually hook up that part.
var controls = new InputMaster();
// Restrict the controls to certain devices.
controls.devices = new InputDevice[] { Keyboard.current, Mouse.current };
// Restrict the controls to one control scheme.
controls.bindingGroup = InputBinding.MaskByGroup(controls.controlSchemes.First(x => x.name == "Keyboard&Mouse").bindingGroup);
Not pretty and not convenient. On the list for improvement.
Finally, we have an open bug where ApplyBindingOverride does not correctly flush out state on actions and old controls end up sticking around. I’ve started looking into it and a fix is expected to land in the next package after 1.0.0-preview.6. My suspicion is that this may be what you’re running into here.
As for saving rebinds, we have adding some more convenient wrappers on this on the list for after 1.0. I’ve posted about how to manually do this here .
@Rene-Damm bumping this to see if the potential fix for rebinding UI successfully impacting the player at runtime is slated to be included in the next update? Between the rebinding action UI prefab, the control binding Ui prefab in the tank demo scene, and a UI of my own I have not been able to apply a binding override so far. This would be a huge plus to get this on the next update (which hopefully is not delayed)
Any timeline on a fix for this? I just can’t figure out why none of my solutions work for this problem. I’d already used the Rebinding UI prefab provided in the Package Manager to set up my rebinding screen, so overcoming the hump of “I bind something, it updates the UI, but my controls dont effectively change for the player” would just make this who feature fall into place. Please save me <3 I’ve been blocked on this feature for a month now
I have the same issue. The RebindUI sample scene doesn’t seem to actually rebind anything. @Rene-Damm should we just go back to using the old input system for the time being? Any estimate on when updates to the input system will be coming? I have other issues such as InputAction.performed or InputAction.cancelled not being fired OnButtonRelease after rebinding which could be related.
Adding the code in UpdateBindingDisplay() logged me the new override path, but it still didn’t trigger any action with the new key binding. The old key binding still works…