Unity3D协程(Demo) 看懂就理解差不多了

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_37067895/article/details/85386264

 voidStart()

    {

       Debug.Log("1");

        StartCoroutine(Do());

       Debug.Log("4");

    }

   IEnumeratorDo()

    {

       Debug.Log("2");

       yieldreturnStartCoroutine(newDo());//WaitForSeconds(5);

       Debug.Log("6");

    }

   IEnumeratornewDo()

    {

       Debug.Log("3");

       yieldreturnnewWaitForSeconds(2);

       Debug.Log("5");

    }

输出结果 1、2、3、4、5

猜你喜欢

转载自blog.csdn.net/qq_37067895/article/details/85386264