Hello everyone,
Note I used different variable/function names from Rick’s examples
In the video, I noticed we can start a Coroutine with:
StartCorotuine(ShootContinuously());
However, to stop the Coroutine, we needed to create a variable as a handle to stop the Coroutine:
if (Input.GetButtonDown("Fire1"))
{
shootingCoroutine = StartCoroutine(ShootContinuously());
}
if (Input.GetButtonUp("Fire1"))
{
StopCoroutine(shootingCoroutine);
I understand why you wouldn’t use StopAllCoroutines, but I’m curious why we couldn’t use:
StopCoroutine(ShootContinuously);
Thanks!