Hello Rick, could you please clarify what’s the difference between your way in the lecture and the one below?
private void Fire()
{
if (Input.GetButton("Fire1"))
{
StartCoroutine(FireContinuously());
}
}
IEnumerator FireContinuously()
{
GameObject laser = Instantiate(laserPrefab, transform.position, Quaternion.identity) as
GameObject;
laser.GetComponent<Rigidbody2D>().velocity = new Vector2(0, projectileSpeed);
yield return new WaitForSeconds(projectileFiringPeriod);
}