I'm trying to make a grenade throwing script but when i test it, it always spawn 2 grenade at the same time.
public class GrenadeThrow : MonoBehaviour {
public GameObject bulletprefab;
float speed =20f;
// Use this for initialization
void Start () { }
// Update is called once per frame
void Update () {
if (Input.GetButtonUp("Fire1"))
{
Camera cam = Camera.main;
GameObject Grenade = Instantiate(bulletprefab, cam.transform.position + cam.transform.forward, cam.transform.rotation);
Grenade.GetComponent<Rigidbody>().AddForce(cam.transform.forward * speed, ForceMode.Impulse);
}
}
}

