Im a bit annoyed with having two methods everytime i need something to be done by a coroutine. I need the coroutine and another method to start the coroutine.
I wanted to solve it by starting a anonymous method as coroutine but I’ve learned it doesn’t work. Is there any other tip or trick out there on how to avoid getting your class bloated with extra methods because of a need of coroutine?
DOTween is a free powerful plugin which can do things like DOVirtual.DelayedCall(), shorthand for a coroutine with a yield, or sequences, where you can stack method calls on top of each other, with delays and parallel… Other than that several of Unity’s messages (Start, OnCollisionEnter…) can return an IEnumerator instead of void and be a coroutine themselves. It’s noted in the API docs if they can.
You don’t need to have a separate method to launch a coroutine: you can call StartCoroutine from any method - Start(), Update() etc. so there’s no reason for any additional bloat at all.