I’m getting this seemingly harmless error message, and it’s kind of like yeah, that was the idea… Is it safe to suppress it? Is there a workaround with the same functionality? I may need the adaptability of using Coroutine instead of IEnumerator, and I read that string is slower…
2 Answers
2Make sure to call StopCoroutine() on the same object (MonoBehavior) that you started the coroutine.
Coroutine myCoroutine = world.StartCoroutine(MyCoroutine());
world.StopCoroutine(myCoroutine);
There is a discussion about this in the forums. Sounds like it’s been fixed multiple times but keeps coming back. It is apparently harmless, and can be worked around by stopping with the IEnumerator instead of the Coroutine.
How can I suppress it? #pragma warning disable doesn't seem to affect it. I'd like to be able to just take out the suppression if they fix it later.
– NoSoup4youDon't know if it's possible to suppress it. How often are you stopping? Using a string probably isn't going to affect performance in a noticeable way unless you're stopping dozens of these every frame or something.
– Dave-CarlileEh, it's only when I go through a music-changing doorway, it stops any ongoing fades before starting a new one, in case the player walks through the door and back quickly. I guess it wouldn't be too hard to rework my activeCoroutine field as a string instead of a Coroutine. I'm just a novice and paranoid about doing everything 100% correct and efficiently for learning purposes.
– NoSoup4you
This was my exact problem, thank you very much!
– Telgemannen