Hello. I followed the video about the new input system and I init this into my project but I got problems with rebindings keys.
Example:
My interact input is on the “E” key, and my crouch input is on the “C” key. When I perform interactive rebinding on crouch input and I press the “E” key there are errors. If I rebind the crouch input on the not occupied key everything works. So basically If I perform rebind on already occupied input there are errors
The error is made by “currentBindingInput” because “controlBindingIndex” is -1. I don’t know why it happens.
private void UpdateBindingDisplayUI()
{
int controlBindingIndex = _inputAction.GetBindingIndexForControl(_inputAction.controls[0]);
var currentBindingInput = InputControlPath.ToHumanReadableString(_inputAction.bindings[controlBindingIndex].effectivePath,
InputControlPath.HumanReadableStringOptions.OmitDevice);
Sprite currentDisplayIcon = deviceDisplaySettings.GetDeviceBindingIcon(_playerInput, currentBindingInput);
ToggleGameObjectState(bindingIconDisplayImage.gameObject, true);
bindingIconDisplayImage.sprite = currentDisplayIcon;
}