IEnumerator PlayCutsSubtitle() { mlCuts.Set(""); float currTime = 0.0f; for (int i = 0; i <= cs.getNoOfSubs(); i++) { yield return(new WaitForSeconds(cs.getSubTime(i) - currTime)); currTime = cs.getSubTime(i) + cs.getSubDuration(i); //The time the subtitle finishes at. if (i < cs.getNoOfSubs()) { //A new sub is due before this one will finish. currTime = Mathf.Min(currTime, cs.getSubTime(i + 1)); } mlCuts.Set(StringController.instance.GetString(cs.StringBlockNo, cs.getSubIndex(i))); yield return(new WaitForSeconds(cs.getSubDuration(i))); mlCuts.Set(""); //Clear the control. } }