Physics acting different in build than in editor

Player movement script:

 void Update()
    {

        if (player.GetButton("start") && fire.gameState == 0)
        {
            fire.startButton();
            restart = true;
            fire.gameState = 1;
        }
        if (player.GetButton("Right"))
            right = true;
        else
            right = false;

        if (player.GetButton("Left"))
            left = true;
        else
            left = false;

        if (player.GetButton("Down"))
            down = true;
        else
            down = false;

        if (player.GetButton("Up"))
            up = true;
        else
            up = false;


    }


        void FixedUpdate()
    {
        if(fire.gameState == 1)
        
            if (right)
            {
                direction = 1;
                transform.position = new Vector2(transform.position.x + speed * Time.deltaTime, transform.position.y);
            }


            else if (left)
            {
                direction = 3;
                transform.position = new Vector2(transform.position.x - speed * Time.deltaTime, transform.position.y);
            }

            else if (up)
            {
                direction = 0;
                transform.position = new Vector2(transform.position.x, transform.position.y + speed * Time.deltaTime);
            }

            else if (down)
            {
                direction = 2;
                transform.position = new Vector2(transform.position.x, transform.position.y - speed * Time.deltaTime);
            }




        }

The boulders just have a rigidbody 2D and polygon collider.

Editor mode: Editor mode - YouTube
Build mode: Build Mode - YouTube

As you can see, physics is acting different, you can easily go past the boulders in build mode but not in edit mode. Where does that come from?

In your fixed update it seems you are missing a pair of curly brackets for the very first if statement. Also please make sure your code is properly tabbed for easy debugging for anyone giving answers. Is this line important: if(fire.gameState == 1) in your fixed update? If it is then it needs to be properly bracketed.

The problem that you have here is that you multiply all your movement values by Time.deltaTime.
Time.deltaTime is not needed here since you are in fixed update. Fixed update always takes place in the same timely distance. So while there always is a FixedUpdate in a interval of 0.02seconds (that is the default i think - look that up in your project physics settings) Time.deltaTime is framerate dependent. So when you build your game an Update takes less time so there are more Update calls between each FixedUpdate than in the Editor.

To keep the correct timescale i’d recommend to use Time.fixedDeltaTime here.

I solve this problem by:

Project Settings → Physics2D → Change “Simulation Mode” to “Update”.