So I have a script that when you click a button a movie plays. I have an IEnumerator to see if the movie is over and when it is close it. My code worked fine until I added the IEnumerator and now I can't call the playMovie function.
Image of why I can't call playMovie
Any ideas on why this might be happening? This is what the code looks like:
public void playMovie(Action callback)
{
GetComponent<RawImage>().texture = myMovie as MovieTexture;
audio = GetComponent<AudioSource> ();
audio.clip = myMovie.audioClip;
myMovie.Play ();
audio.Play ();
StartCoroutine (FindEnd (callback));
}
private IEnumerator FindEnd(Action callback)
{
while (myMovie.isPlaying)
{
yield return 0;
}
callback ();
yield break;
}
StartCoroutinemethod actually enumerate theIEnumerator? (i. e. does it useforeachon it?) - Chris DunawayStartCoroutine (FindEnd (callback));as aTask.Factory.StartNew(() => FindEnd(callback), TaskCreationOptions.None, TaskScheduler.FromCurrentSynchronizationContext()).Unwrap();and theyield return 0;as aawait Task.Yield();- Scott Chamberlain