- Home /
Limited Fire Rate?
Lately i have been working on a gun script... How can i modify my code, so it has a limited fire rate. Instead of it relying on how fast you can click.
The Code...
var Bullet : Transform;
var BulletSpeed : int=300;
function Update () {
if (Input.GetButtonDown ("Fire1")){
var Bullet=Instantiate(Bullet,GameObject.Find("BulletSpawn").transform.position,Quaternion.identity);
Bullet.rigidbody.AddForce(transform.forward * Time.deltaTime * BulletSpeed);
}
}
Thanks.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613063710im_/https://answers.unity.com/themes/thub/images/avi.jpg)