I am having trouble with coroutines. I have 2 buttons and a global variable.
The global variable is created like this
IEnumerator makeBubbles;
On 1 button I have this
makeBubbles = StarCo();
StartCoroutine(makeBubbles);
On my other button I have this:
StopCoroutine(makeBubbles);
When I click the first button the coroutine runs but on the second button press I get this error:
NullReferenceException: routine is null
UnityEngine.MonoBehaviour.StopCoroutine (System.Collections.IEnumerator routine) (at <6afd1274f120405096bc1ad9e2010ba6>:0)
↧