Hi, On my game cut scenes, I've use a SceneManager() Coroutine in which I use something like: Code (csharp): //SCENE VILLAGE Cam[0].enabled = true; Cam[1].enabled = false; SceneRoot[0].animation.clip = ACCSIntro[0]; SceneRoot[0].animation.Play(); //yield return new WaitForSeconds(0.5f); CS_Intro_SoundSystem.SoundOn[0] = true; yield return new WaitForSeconds(12f); Finger.SetActiveRecursively(false); yield return new WaitForSeconds(ACCSIntro[0].length-12f); SceneRoot[0].animation.clip = ACCSIntro[1]; SceneRoot[0].animation.Play(); yield return new WaitForSeconds(ACCSIntro[1].length); SceneRoot[0].animation.clip = ACCSIntro[2]; SceneRoot[0].animation.Play(); yield return new WaitForSeconds(ACCSIntro[2].length); Girl[0].SetActiveRecursively(true); Girl[1].SetActiveRecursively(false); SceneRoot[0].animation.clip = ACCSIntro[3]; SceneRoot[0].animation.Play(); yield return new WaitForSeconds(ACCSIntro[3].length-1f); Basically a series of : SceneRoot[0].animation.clip = ACCSIntro[0]; SceneRoot[0].animation.Play(); yield return new WaitForSeconds(ACCSIntro[0].length); I'm calling that Coroutine in the Start() function And I found it pretty much straight forward and easy to use. Here, the case is slightly different, I want to use that same technique, but the user will touch the screen to move on to the next part so something like that : SceneRoot[0].animation.clip = ACCSIntro[0]; SceneRoot[0].animation.Play(); yield return new WaitForSeconds(ACCSIntro[0].length-5); NextButtonOnOff = true; if(Next) -> SceneRoot[0].... is there a way to sort of Waiting for this next bool to be true to continue in the coroutine? I could do it with a lot of "if" and recall all the time the coroutine, but I'm looking for a clean way of doing it. Basically how to pause a coroutine until bool returned (button pressed). Thanks for the help
What if Coroutine is waiting for 1 sec, then it reached 0.4 sec ( thus needs to wait 0.6 more). At this specific time, i need the coroutine to pause, then recontinue counting the second ( or the remaining 0.6) Is that feasible?
yeah: Code (csharp): float timer = 0f; while(timer < 1f) { while(!some_condition) { yield return null; } timer += Time.deltaTime; yield return null; }