I have been looking around but can’t seem the proper way to stop a coroutine from running. I tried StopCoroutine() but that didn’t seem to work. A little help would be great!
Wow lots of responses! Lots to try haha, thanks all!
the yield break was what I am looking for. It was the simple solution that always alludes me.
I actually tried changing the while(true) to while(dist > 0.5) but then I didn’t have a good way to update the dist within the coroutine. Hence why I had to change it.
You don’t even need a yield break if you let the code run to the end, then the coroutine will exit. So a break to break out of the while loop would’ve sufficed.