输入系统在交互式重新绑定后不会删除默认绑定,统一

Pet*_*rrr 6 c# unity-game-engine

我一直致力于统一输入系统中的交互式重新绑定。但由于某种原因,旧的按键绑定仍然有效。默认值为 wasd,但如果我在菜单中将其重新绑定到箭头,则箭头和 wasd 都会移动它。如果我在将其重新绑定到另一个箭头后重新绑定,它会使用 wasd 和新重新绑定的键,因此它不会删除它。它更像是保持默认活动。

private void startRebinding(Button button, InputActionReference action, TMP_Text display, int bindingIndex = -1)
{
    button.interactable = false;
    display.text = waitingForInputText;
    action.action.Disable();
    playerInput.SwitchCurrentActionMap("UI");
    action.action.PerformInteractiveRebinding(bindingIndex)
        .OnMatchWaitForAnother(0.1f)
        .OnComplete(operation =>
        {
            display.text = InputControlPath.ToHumanReadableString(
                action.action.bindings[bindingIndex].effectivePath,
                InputControlPath.HumanReadableStringOptions.OmitDevice);

            operation.Dispose();
            button.interactable = true;

            playerInput.SwitchCurrentActionMap("Player");
            action.action.Enable();
        })
        .Start();
}
Run Code Online (Sandbox Code Playgroud)

如果您设置新的按键绑定,我该如何使其停止使用默认的按键绑定。