hello
I created this script:
using UnityEngine;
using System.Collections;
public class Shooting : MonoBehaviour
{
public Rigidbody Bullet;
public float bulletSpeed = 100;
public int fireRate = 50;
int Updates;
void Update()
{
if(Input.GetButtonDown("Fire1") Updates >= fireRate)
Debug.LogError("The if statment is coming here");
Updates++;
{
Updates = 0;
Rigidbody newBullet = Instantiate(Bullet, transform.position, transform.rotation) as Rigidbody;
newBullet.velocity = transform.TransformDirection(new Vector3(0, 0, bulletSpeed));
}
}
}
the problem is that the script dont wait until i click on fire1
it just create more and more bullets and i dont know where is my wrong
someone can help me please?
thx for the help