Pretty new to Unity and C#, but I’ve been searching for a easily-understandable way to have a short time delay in-between Instantiating bullets, as right now you can just spam shoot.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Weapon : MonoBehaviour {
public Transform FirePoint;
public GameObject BulletPrefab;
// Update is called once per frame
void Update () {
if (Input.GetButtonDown("Fire1"))
{
Shoot();
}
}
void Shoot ()
{
Instantiate(BulletPrefab, FirePoint.position, FirePoint.rotation);
}
}
Thanks in Advance