Search Unity

Bug Input System not rebinding ... 2021.1.5f1

Discussion in 'Input System' started by toomasio, Apr 28, 2021.

  1. toomasio

    toomasio

    Joined:
    Nov 19, 2013
    Posts:
    199
    I noticed that my rebinds have stopped working. Ran a simple test and not sure what I am doing wrong?

    Code (CSharp):
    1. public class RebindTest : MonoBehaviour
    2. {
    3.     [SerializeField] private InputActionReference reference;
    4.  
    5.     // Start is called before the first frame update
    6.     void Start()
    7.     {
    8.         var action = reference.action;
    9.  
    10.         action.Disable();
    11.  
    12.         Debug.Log($"rebinding input: {action.name}");
    13.         var rebindOperation = action.PerformInteractiveRebinding()
    14.                 .WithControlsExcluding("<Mouse>/position")
    15.                 .WithControlsExcluding("<Mouse>/delta")
    16.                 .WithControlsExcluding("<Gamepad>/Start")
    17.                 .WithControlsExcluding("<Keyboard>/p")
    18.                 .WithControlsExcluding("<Keyboard>/escape")
    19.                 .OnMatchWaitForAnother(0.1f)
    20.                 .OnApplyBinding((operation, pathResult) =>
    21.                 {
    22.                     var rebindPathResult = pathResult;
    23.                     var rebindNameResult = InputControlPath.ToHumanReadableString(pathResult);
    24.                     Debug.Log($"{rebindPathResult} | {rebindNameResult}");
    25.                     operation.Dispose();
    26.                     action.Enable();
    27.                 });
    28.  
    29.         rebindOperation.Start();
    30.     }
    31. }
    _.jpg