// Use this for initialization void Start() { Debug.Log("start1"); //test yield wait second StartCoroutine(Init(1)); Debug.Log("start2"); Debug.Log("start3"); //test yield wait null StartCoroutine(Run()); Debug.Log("start4"); Debug.Log("start5"); //test function call another StartCoroutine StartCoroutine(Test()); Debug.Log("start6"); Debug.Log("start7"); //test www StartCoroutine(Read()); Debug.Log("start8"); Debug.Log("start9"); //test function call another yield wait second StartCoroutine(Pass()); Debug.Log("startA"); Debug.Log("startB"); //test for loop bool IsTimeout = true; float fTimeout = Time.time + 3.0f;//test 3 second int iCount = 0; while (IsTimeout) { //yield return new WaitForSeconds(1.0f);//每隔一秒//這種做法才有效果,先call函式之後再call yield會無限call StartCoroutine,導致unity掛 Debug.Log("startC"); Debug.Log("startD"); StartCoroutine(Loop());//這種做法無法做到等1秒 Debug.Log("startE"); Debug.Log("startF"); //after test , break loop if (Time.time > fTimeout) { IsTimeout = false; } //use count to break loop iCount++; if (iCount > 5) { IsTimeout = false; } } //print Caller function name CalledMethodBringer.Instance().CalledMethod(false); Debug.Log("startG"); Debug.Log("startH"); }
// Use this for initialization void Start() { Self = this; }