Unity3D开启协程倒计时

代码如下:

 IEnumerator cutTime(float timer)
    {
        while (timer >-1)
        {
            yield return new WaitForSeconds(1);
            Debug.Log(timer);
            if (timer == 0)
            {
               Debug.Log("需要执行的方法");
            }
            timer--;  
        }
    }
原文地址:https://www.cnblogs.com/htwzl/p/7262174.html