Shenma is a float cloud. in unity, you can write the source code of Coroutine coroutine.

Source: Internet
Author: User

Shenma is a float cloud. in unity, you can write the source code of Coroutine coroutine.

Sun Guangdong 2014.7.19

You can see that an article on the Unity wiki is about writing coroutine by yourself. I think it is very good, so that I can better understand the operating mechanism and other features of the coroutine.

The original Article URL is as follows:

Http://wiki.unity3d.com/index.php? Title = CoroutineScheduler


Project address: http://download.csdn.net/detail/u010019717/8912069

The specific content is as follows:
A simple Collaborative Scheduling program. This collaborative scheduling program allows full control over the execution mechanism of a set of collaborative programs. Reading the Code also helps you understand how collaboration works behind the scenes. Building on how a collaborative program builds a. Net generator will allow you to add collaborative support to a non-Unity project.

Collaborative yield can wait until the next update "yield;", until the specified number of updates has passed "yield anInt;" until the given second has passed "yield aFloat ;", or until another coroutine has completed "yield scheduler. startCoroutine (Coroutine ());". startCoroutine (Coroutine ());".

Multiple scheduling program instances are supported and can be very useful. Collaborative running can run under a different scheduler instance (waiting ).

Do not use the YieldInstruction class of Unity, because we cannot access the internal data of the scheduling required for this class. Semantics is slightly different from the scheduling program of Unity. For example, in Unity, if you start to collaborate with it, it will run immediately for its first yield. However, in the self-written scheduler, it will not run until the next call to UpdateAllCoroutines. This feature allows you to start a coroutine at any time in any code. At the same time, make sure that the coprocessor can only run at a specific time.

The updated order should not be dependent between the same update cooperations.

For more in-depth understanding and learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.