AddForce works in Editor but not in build

I’m currently creating a game similiar to Lunar Lander, but i’m currently stuck on a weird problem. Rigidbody.AddForce completely works in the Editor, but not in the final build/during runtime. Here’s my affected script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Controller : MonoBehaviour
{
    public GameObject rocket;
    public ParticleSystem particles;

    public Rigidbody2D rbRocket;

    public float thrust = 1.0f;
    public float mass;
    public static float fuel = 100;
    public float loss = 1;

    public static bool SAon = false;
    public bool wastingFuel = false;

    // Start is called before the first frame update
    void Start()
    {
        particles = GetComponent<ParticleSystem>();
        rbRocket = rocket.GetComponent<Rigidbody2D>();
        particles.Stop();
    }

    // Update is called once per frame
    void Update()
    {
        if (fuel <= 0)
        {
            return;
        }

        if (Input.GetKey(KeyCode.W))
        {
            rbRocket.AddForce(Time.timeScale * thrust * transform.up);
        }

        float horizontalKeys = Input.GetAxis("Horizontal");

        rbRocket.AddTorque(-horizontalKeys * (rbRocket.mass / 4));

        if (Input.GetKey(KeyCode.W))
        {
            fuel -= Time.deltaTime * loss;
            particles.Play();

        }
        if (Input.GetKeyUp(KeyCode.W))
        {
            particles.Stop();
        }

        if (SAon)
        {
            rbRocket.angularDrag = 5;
        }
        else
        {
            rbRocket.angularDrag = 1;
        }

        if (Pause.isPaused == true)
        {

        }
    }

    void FuelGone()
    {

    }
}

(The player flies using AddForce in the editor, but doesn’t in the final build)

NOTE: I’m not able to use FixedUpdate() since that makes that problem also occur in the editor.

AddForce adds impulse and therefore speed over time. Specifically, it uses the fixedDeltaTime, in the FixedUpdate.
In general, you should be applying forces and impulses to any rigidbodies in the FixedUpdate instead of Update, as it’s synchronized with it (Update and FixedUpdate are not synchronized, and one can be called more times than the another). AddForce wikth default Force mode is also already applied ‘over time’, which means you should not multiply the force by deltaTime . If you want to do that for some reason, use ForceMode.Impulse instead.

It looks to me like your problem is that the way you are adding force is framerate dependent, since you are calling addForce in Update(). I would try multiplying your thrust variable by Time.deltaTime, and it should hopefully fix your problem. I had a very similar scenario as yours and found that it worked, but you may have to increase your thrust quite significantly. For example:

public float thrust = 500.0f

if (Input.GetKey(KeyCode.W))
         {
             rbRocket.AddForce(Time.timeScale * thrust  * Time.deltaTime * transform.up);
         }