Are we not able to call a coroutine from the Update() method? I have some code that if run in the Update() method works, but if I try to put it into a function and then run it as a coroutine it’s like it never gets called.
This is in C#. I define the method return an IEnumerator and call it with StartCoroutine(). So what am I missing?
it gets called but once every update ie once per frame so you likely get a massive overload.
if you need to run something in update, just run it there.
if you need something running independent of it, have the Startcoroutine in start and let it loop in the coroutine
I see. I have some if conditions and such in the Update() that prevent such things from calling constantly and placing StartCoroutine() in those seems to work. Thanks!
Would be nice if Unity said something about it getting called to many times.
there is no “called too many times” but likely your coroutines set and reset states and if they run in parallel they override each other leading to the same problem thats basically the major problem with threads and parallel programming on multicore machines
It’s weird then because I have audio playing in them and I don’t hear anything. I would think the audio would play like mad. Either way it’s working now, thanks!