So the situation is i have two monobehaviours(object1 and object2)
object1 is running coroutine that waits for coroutine running on object2 and the problem is that when i call object2.StopAllCoroutine() object2 coroutine stops, but coroutine on object 1 does not resume
Example:
public class RootObject: MonoBehaviour
{
private CoroutineHost coroutineHost;
public void Start()
{
var go = new GameObject();
coroutineHost = go.AddComponent<CoroutineHost>();
this.StartCoroutine(GamePlayRoutine());
this.StartCoroutine(StopAllCoroutinesRoutine());
}
public IContained<IGameplay> gameplay
{
get;
set;
}
private IEnumerator GamePlayRoutine()
{
yield return coroutineHost.StartCoroutine(gameplay.contained.Run());
Debug.Log("!!!!");
gameplay.Dispose();
}
private IEnumerator StopAllCoroutinesRoutine()
{
yield return new WaitForSeconds(1.0f);
Debug.Log("Killing Coroutines");
coroutineHost.StopAllCoroutines();
}
}
In this example only Killing Coroutines is being printed, but never “!!!”