简体   繁体   中英

What is the difference between yielding a coroutine function call and yielding a startcoroutine call

Unity coroutines can be chained together sequentially using something like the following

private void IEnumerator Outer()
{
    yield return StartCoroutine(Inner());
}

private void IEnumerator Inner() { yield break; }

However, the following also seems to do the same thing

private void IEnumerator Outer()
{
    yield return Inner();
}

What actually is the difference between the two methods, is one preferred over the other. I have only really seen the first in examples but the second has some really key benefits it seems (mainly not needing a monobehaviour to call StartCoroutine on)

快速谷歌搜索结果在这个线程中有很好的解释(IMO)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM