startCoroutine()用法总结

官方链接(英文)


所属API

monoBehavior

代码块

语法

public Coroutine StartCoroutine(IEnumerator routine);

作用

开始一个coroutine。
The execution of a coroutine can be paused at any point using the yield statement. The yield return value specifies when the coroutine is resumed. Coroutines are excellent when modelling behaviour over several frames. Coroutines have virtually no performance overhead. StartCoroutine function always returns immediately, however you can yield the result. This will wait until the coroutine has finished execution. There is no guarantee that coroutines end in the same order that they were started, even if they finish in the same frame.

备注

写js时用不着调用startCoroutine(),js会自动做这件事。写C#时则需要调用。

疑问

startCoroutine()的返回值也是一个IEnumerator类型的值?

你可能感兴趣的:(unity)