Increase force/size the longer input has been held down.

So I’ve got a character who on left click, instantiates and fires a bullet from his gun at a constant force using rigidbody.addforce but now I want to add it so the longer you hold the left click down, it will increase in size and force (with a capped limit) until then when you release it fires the projectile.

It’s sort of like Samus’ bullet in super smash Bros. The longer you hold down it charges more.
Thanks all answers appreciated.

Just add a couple floats to the stop of your class that handles shooting/creating the bullet. Maybe add a variable to the bullet class if it’s a networked object and you set the force inside the bullet objects script(s).

public float BaseForce;
public float MaxForce;
public float ForceIncRate;
private float CurrentForce;
private bool Charging;

void Update() {
    if(input.GetButton("Fire1")) {
        if(!Charging) {
               CurrentForce = BaseForce;
               Charging = true;
        }
        else {
            CurrentForce += ForceIncRate * Time.deltaTime;
        }
    }
   else if(!Input.GetButton("Fire1") && Charging) {
        Fire(CurrentForce);
        Charging = false;
    }
    
}

public void Fire(float force) {
/// create bullet with force here
}

Could you maybe expand on line 24 and below, how would i go about doing creating the bullet. i understand the rest @NerdHerdGames