Wednesday, November 30, 2022
HomeGame Developmentunity - Is there a approach round utilizing yield return null for...

unity – Is there a approach round utilizing yield return null for coroutines to keep away from ready an additional body on the finish of my coroutine?


I’ve gotten used to utilizing coroutines as a approach to make sure a issues are completed sequentially in my code, i.e. as a substitute of calling methodology a, methodology b, and methodology c on again to again traces I’ll typically yield return StartCoroutine(methodology a()), and many others to make sure methodology a is totally completed earlier than beginning methodology b. (Is it sensible or vital to do that? I may very well be lacking one thing apparent that might let me ditch utilizing coroutines on this approach. Nonetheless a comparatively new programmer!)

Anyway, again to my major query. Is there a approach to make use of a coroutine that basically bypasses using a yield return null on the finish of it? For the reason that yield return null waits an additional body earlier than the coroutine is allowed to complete and I exploit them loads, I might wish to get round any unneccessary ready round in my code. Hopefully my query is smart, let me know if I can present any clarification!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments