首页 > 其他分享 >Unity Coroutine和async、await对比

Unity Coroutine和async、await对比

时间:2023-02-20 11:57:41浏览次数:39  
标签:协程 Coroutine await yield Unity async

此篇文章,不谈原理,只聊用法,对比着看更容易理解

 

 上述代码执行的逻辑顺序是一样的

定义异步方法,协程用 IEnumerator,线程用 async

具体异步执行的内容,协程用 yield,线程用 await

执行完 yield 或者 await,再执行下面的代码

标签:协程,Coroutine,await,yield,Unity,async
From: https://www.cnblogs.com/Jason-c/p/17136815.html

相关文章