This article has participated in the Denver Nuggets Creators Camp 3 “More Productive writing” track, see details: Digg project | creators Camp 3 ongoing, “write” personal impact.
Coroutine continues failure
Coroutine continues to fail
Use the following code:
void StartAni()
{
StartCoroutine(Next());
// Do something
StopCoroutine(Next());
}
IEnumerator Next()
{
//do sth
for (int i = 0; i < scintilla.Length; i++)
{
guang_Image.sprite = scintilla[i];
guang_Image.SetNativeSize();
yield return new WaitForSeconds(0.06 f); }}Copy the code
When the StartAni method above is executed, this error will occur. After practice, this error does not affect the program. I am still curious about what the problem is, but I did not find much information on the Internet. Try the following call as well, but the result is still an error.
void StartAni()
{
StartCoroutine("Next");
// Do something
StopCoroutine("Next");
}
Copy the code