Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //코루틴 A
- IEnumerator CoroutineA()
- {
- Debug.Log("start A");
- yield return new WaitForSeconds(3.0f);
- Debug.Log("finish A");
- }
- //코루틴 B
- IEnumerator CoroutineB()
- {
- Debug.Log("start B");
- yield return new WaitForEndOfFrame();
- Debug.Log("finish B");
- }
- // 코루틴A 가 종료된 후 이어서 코루틴B 를 실행한다.
- var cancel = Observable.FromCoroutine(CoroutineA)
- .SelectMany(CoroutineB) //SelectMany : 다른 스트림으로 교체
- .Subscribe("Subscribe!");
- //Dispose 를 호출하 코루틴을 중단할 수 있다.
- //cancel.Dispose();
- //---결과---//
- start A
- finish A
- start B
- finish B
- Subscribe!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement