I am making a game where the player moves a spaceship with a mouse, and automatically shoots things that randomly spawn from the top of the screen. However, when I try to make it shoot bullets, the bullets shoot, but there isn’t any space in between each bullet. Any suggestions?
This is the code I am using:
public GameObject playerBulletPrefab;
private float startDelay = .75f;
private float shootInterval = 5.0f;
void Start()
{
}
void Update()
{
InvokeRepeating("ShootBullet", startDelay, shootInterval);
}
void ShootBullet()
{
Instantiate(playerBulletPrefab, transform.position, playerBulletPrefab.transform.rotation);
}