Last active
August 29, 2015 13:57
-
-
Save fujimisakari/9440408 to your computer and use it in GitHub Desktop.
コルーチンについて ref: http://qiita.com/fujimisakari/items/811e350cbaeb45b6165e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void Start () { | |
| StartCoroutine("Coroutine1"); | |
| } | |
| void Update () { | |
| Debug.Log ("Update."); | |
| } | |
| public IEnumerator Coroutine1() | |
| { | |
| Debug.Log("Start-1"); | |
| Debug.Log("--------"); | |
| yield return StartCoroutine("Coroutine2"); | |
| Debug.Log("--------"); | |
| Debug.Log("Start-2"); | |
| yield return null; | |
| Debug.Log("Start-3"); | |
| } | |
| private IEnumerator Coroutine2() | |
| { | |
| Debug.Log("Nest-1"); | |
| yield return null; | |
| Debug.Log("Nest-2"); | |
| yield return null; | |
| Debug.Log("Nest-3"); | |
| } | |
| // 実行結果 | |
| // | |
| // Start-1 | |
| // -------- | |
| // Nest-1 | |
| // Update. | |
| // Update. | |
| // Nest-2 | |
| // Update. | |
| // Nest-3 | |
| // -------- | |
| // Start-2 | |
| // Update. | |
| // Start-3 | |
| // Update. | |
| // Update. | |
| // : | |
| // : |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Debug.Log("Nest-2"); | |
| yield return null; | |
| Debug.Log("Nest-3"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Start-1 | |
| -------- | |
| Nest-1 | |
| Update. | |
| Update. | |
| Nest-2 | |
| Update. | |
| Nest-3 | |
| -------- | |
| Start-2 | |
| Update. | |
| Start-3 | |
| Update. | |
| Update. | |
| : | |
| : |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment