Is there an advantage to caching the coroutine over using a simple bool?
In my solution I set the bool to true at the start and false at the end. Then I check the status of that bool before starting the coroutine.
Caching the coroutine seems to do the exact same thing but setting a value to null instead of false.
Is there an advantage to this approach?
I know that the bool doesn’t account for the coroutine being stopped by something else before the bool is set to false, but as I understand it, neither does caching the coroutine. The cached coroutine is only null if it has never been run or it was manually set to null by reaching the end of the coroutine.
I don’t know much about how c# works under the hood but it seems to be a simple bool would be a smaller use of resources than a reference to a coroutine