public Cothread StartCothread(IEnumerator routine, GameObject owner) { CothreadsBehaviour cb = owner.GetComponent <CothreadsBehaviour>(); if (cb == null) { cb = owner.AddComponent <CothreadsBehaviour>(); } Cothread th = StartCoroutine(routine); cb.AddCothread(th); return(th); }
public void AddCothread(Cothread thread) { threads.Add(thread); thread.ev.onSet += onClose; }