Problems with override rebinds

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;
     }


Sorry for the necro but I also stumbled upon this issue as well after following Warriors Input video (

).

The issue seems to be fixed in 1.1.0-pre.5 (maybe earlier, this is the version I just tested).

I’ve tested simple scene with a gameobject with PlayerInputManager calling Test() function:

using UnityEngine;
using UnityEngine.InputSystem;

public class TestActions : MonoBehaviour {
  public void Test (PlayerInput _input) {
    Func("Join game", _input);
    Func("Leave game", _input);
  }

  private void Func (string _action, PlayerInput _input) {
    var foundAction = _input.actions.FindAction(_action);
    Debug.Log($"{_action} action: {foundAction}");
    int index = foundAction.GetBindingIndexForControl(foundAction.controls[0]);
    Debug.Log($"{_action} index: {index}");
  }
}

Results were InputSystem 1.0.2 always returned index -1 if I had two actions assigned to the same binding.

Index is correctly returned in the 1.1.0-pre.5 version.



7392932--902804--inputsystem 1.0.2.png
7392932--902807--inputsystem 1.1.0-pre.5.png