Home > other >  Questions about coroutines calls
Questions about coroutines calls

Time:04-21

Coroutines have a yield return null: according to the unity of the official explanation is that the next frame until it continues to run, at the same time, according to life cycle should be at the back of the Update operation

Here is my question: in the Start Awake OnEnable coroutines running test Start
 
Private void Awake ()
{
//StartCoroutine (" tt ");
}

Private void OnEnable ()
{
//StartCoroutine (" tt ");
}

Private void the Start ()
{
StartCoroutine (" tt ");
}

Private int a=0;

Void the Update ()
{
Print (" Update ");

}
IEnumerator (tt)
{
Print (" IEnumerator ");
Yield return null;
Print (" tt ");

}

The result is:
Coroutines in the Start is performed after two Update, conform to the unity of official explanation
Awake/coroutines Onenable is performed after an Update, this is very strange, isn't it should be the next frame to perform, and how the frame is carried out

CodePudding user response:

The top!

CodePudding user response:

May be Awake/Onenable and Update time between frames, waiting for coroutines in that frame,

CodePudding user response:

Wan chun

CodePudding user response:

There are bosses to explain

CodePudding user response:

refer to the second floor a769300126 response:
may be Awake/Onenable and Update time between frames, waiting for coroutines in that frame,

This may be used, I need to clear some ah, want to have a theoretical basis
  • Related