Inputs not working after build

I am working on a platformer in unity, and just to check if everything was working, I built it as the PC, Mac & Linux Standalone, and I encountered a strange issue: The game would detect if a key was being pressed, or had just started being pressed, but not when it had been released meaning that when I pressed a key to move left or right, I would continually move in that direction until another key is pressed, regardless of whether I am still holding down the initial key. A similar issue happens with jumping, the game should have a double jump, but I can single jump, because the game still thinks I am holding down jump button from the first jump.

Here are some code samples if anyone is interested (everything works fine inside the editor and uses the new input system):

//OnRight or OnLeft is triggered when a key is pressed or released, so I made a bool to detect whether it was being held down    

//press d to move right
    public void OnRight()
    {
        if (isRight == false)
        {
            isRight = true;
        }
        else
        {
            isRight = false;
        }
    }

    //press a to move left
    public void OnLeft()
    {
        if (isLeft == false)
        {
            isLeft = true;
        }
        else
        {
            isLeft = false;
        }
    }

And this one:

//this allows the key presses to move you
            if (isLeft == true)
            {
                body.velocity = new Vector2(speed * -1, body.velocity.y);
            }

            if (isRight == true)
            {
                body.velocity = body.velocity = new Vector2(speed, body.velocity.y);
            }

Are you using the new Input System? If so you need to add the Press interaction set up with Press and Release Interactions | Input System | 1.0.2

I covered the new Input System in detail in this tutorial How to use NEW Input System Package! (Unity Tutorial - Keyboard, Mouse, Touch, Gamepad) - Code Monkey

Although that should work the same way in the Editor or in a Build, maybe you have some error happening in your Build, check the log files Unity Tip: Unity Crashed! Why? - Code Monkey

I have tried setting InputSystemUIInputModule’s pointer behaviour to all available options, and I’ve tried setting the Project Settings > Input System Package > Update Mode to all available options also.

Staples Advantage Account

Please show how you are using Input.GetKeyDown() and Input.GetKeyUp().