- Home /
Coroutines white death causes?
In my project I have a wide usage of coroutines and playmaker FSMs. At some point in the execution of a scene something goes really wrong: suddenly all coroutines stop without any error, after this occurs some FSMs get disabled after a trigger event. The only way I noticed the coroutines are not executing anymore is by their lack of effects and through the Monodevelop code debugger, I placed breakpoints in said coroutines and it didn't stop there.
I wasn't able to find any code responsible for this, also because I don't know what to look for. As far as I know, to kill all the coroutines in a scene it would take a .StopAllCoroutines on every script in the scene, no such thing in my code.
Also, there are no in-game events that match the particular moment in which the wild bug appears.
I've also tried my project from another pc. The bug there just doesn't show up. I then tried to re-install unity, have a clean clone of the project from repository and it still happened. My next attempt will be to use a virtual machine to install unity and test for that bug in the new environment... please help!
Here is the code from one of the coroutines:
protected virtual void OnEnable () {
initialize();
StartCoroutine (slowUpdate());
}
public virtual void initialize(){
if (debug)
Debug.Log ("baseInvaderMovement initialize:");
}
protected virtual IEnumerator slowUpdate(){
while(true)
{
if (debug)
Debug.Log ("BaseInvaderMovement slowUpdate Interval (speederInv):"+slowFrameInterval);
yield return new WaitForSeconds(slowFrameInterval);
slowUpdateCycle();
}
}
protected virtual void slowUpdateCycle(){
if (debug)
Debug.Log ("slowUpdate Interval (baseInv):"+slowFrameInterval);
//do stuff on gameobject
}
If this script is disabled and then enabled it will execute a single time its slowupdatecycle and then die without a word again. Precisely it dies on the yield return new WaitForSeconds instruction.
http://forum.unity3d.com/threads/fixed-coroutine-issue-coroutine-stopped-for-no-reason.329317/
I cant find much on the issue.
Thanks meat5000 for the reply, I checked the project for Invoke methods instances, only found one in playmaker scripts. Decided to log its input, only gets 0 as input, correctly logged. But maybe some other things could be producing the same effect... I wish I knew what...