simple shooting script help

i am a noob with cs. i have a projectile script that shoots on click, i want to remove that function and add a function that makes it shoot every second. here is the script:
using UnityEngine;
using System.Collections;

public class ShootDemo : MonoBehaviour
{
    public Rigidbody projectile;
    public float speed = 20;
 
  
    void Update ()
    {
        if (Input.GetButtonDown("Fire1")) // this is the part i want to change
        {
            Rigidbody instantiatedProjectile = Instantiate(projectile,transform.position,transform.rotation)as Rigidbody;
            instantiatedProjectile.velocity = transform.TransformDirection(new Vector3(0, 0,speed));
        }
    }
}

so what i need it for it to shoot WITHOUT CLICKING

any help would be great

thankyou

This should work:

using UnityEngine;
using System.Collections;

public class ShootDemo : MonoBehaviour
{
	public Rigidbody projectile;
	public float speed = 20;
	float timeOver = 0f;
	public float shootEvery = 1f;
	void Update ()
	{
		if (timeOver < shootEvery)
			timeOver += Time.deltaTime;
		else{
			timeOver -= shootEvery;
			Rigidbody instantiatedProjectile = Instantiate(projectile,transform.position,transform.rotation)as Rigidbody;
			instantiatedProjectile.velocity = transform.TransformDirection(new Vector3(0, 0,speed));
		}
	}
}

According to this, I modified it a little bit to fit your needs, so the code would be this:

using UnityEngine;
using System.Collections;

public class ShootDemo : MonoBehaviour
{
    public Rigidbody projectile;
    public float speed = 20F;
    public float fireRate = 0.5F;
    private float nextFire = 0.0F;

    void Update() {
        if (Time.time > nextFire) {
            nextFire = Time.time + fireRate;
            Rigidbody instantiatedProjectile = Instantiate(projectile,transform.position,transform.rotation)as Rigidbody;
            instantiatedProjectile.velocity = transform.TransformDirection(new Vector3(0, 0,speed));
        }
    }
}

float fire_reshoot_track; //defined outside update loop that we use to store when weapon can be fired next
float interval; //defined outside update loop

//inside update loop
if ( fire_reshoot_track < Time.time ) 
{
    Fire ();
    fire_reshoot_track = Time.time + interval;
}

I don’t know where I saw this method of tracking refire rates, but I prefer it to other methods I see.