Input Manager Rebinding Keys Not Working

I got the Input Manager working well but then I wanted to add letting the user pick their keys. I did a bunch of work with Rebinding just one key to get it working and I couldn’t make it work. I traced it down to it was changing the overridePath and effectivePath but it always continued to use the original key and did not use the newly selected key. I am using version 1.5.1 and editor version 2022.3.0f1. There is so little code here that I can’t even try much. I tried deleting the original binding but that did nothing, By that I mean it didn’t delete it. Any help would be appreciated.

I somehow went down a rabbit hole and everything got complex, but nothing got better. Finally I asked ChatGPT for the simplest version it could write and it worked:

public class RebindingScript : MonoBehaviour
{
    public InputActionAsset inputActionAsset;
    private InputAction jumpAction;

    void Start()
    {
        // Directly reference the action from the InputActionAsset
        jumpAction = inputActionAsset.FindAction("Jump");
    }

    public void RebindAction()
    {
        jumpAction.Disable();
        jumpAction.PerformInteractiveRebinding()
            .WithControlsHavingToMatchPath("<Keyboard>")
            .OnComplete(operation =>
            {
                Debug.Log($"Rebinding complete! New binding: {jumpAction.bindings[operation.bindingIndex].effectivePath}");
                jumpAction.Enable();
                operation.Dispose();
            })
            .Start();
    }
}

I hope this helps someone else not waste so much time on nothing.