Excess shot at the first press of a button.

Hallo.
I have a little problem with which I do not trust myself.
when i press a button (space) after a break, it flies out a lot of missiles but after some time shotting back to regular delays. From my observations quantity of missiles = time betweer shoot * fireRate in unity:

public float fireRate;
private float fireRate1 =  1f;
public GameObject Arrow

private void Start()
    {
        fireRate1 = Time.time + -1f;
    }
void Update()
    {
      if (Time.time >= fireRate1)
        {

            if (Input.GetButton("Fire1"))
            {

                fireRate1 = fireRate1 + fireRate;
                Vector3 position = new Vector3(transform.position.x, transform.position.y + (transform.localScale.y / 2 + 1), transform.position.z);
                Instantiate(Arrow, position, Quaternion.identity);
                
                {
                    GetComponent<AudioSource>().Play();

                }  
            }    
        }
    }

Thanks you for helping
Regards.

The reason it’s firing a lot at once and then catching up is because you are using Time.time and comparing it to a value that you are simply adding to. Over time, Time.time will increase drastically, but “fireRate1” only increases by a certain amount each time.

I would recommend using a separate timer and incrementing it each frame using Time.deltaTime. Something like this:

private float _fireTimer;

void Update()
{
    _fireTimer += Time.deltaTime;
    
    if(Input.GetButton("Fire1"))
    {
        if(_fireTimer >= fireRate)
        {
            _fireTimer = 0;
            var position = new Vector3(blah, blah, blah);
            Instantiate(Arrow, position, Quaternion.identity);
            GetComponent<AudioSource>().Play();
        }
    }
}