i want to play the video automatically when the scene starts and when the video is over the next video should appear …
i used the yield WaitForSecons(movieDuration); but when the user pauses the video …it goes to next video evenif the video is not over and not finished watching…
where and how should i use the yield or other unit functions
below is the code i used…
function OnGUI(){
GUI.BeginGroup (Rect (0, 0, 1200, 675));
GUI.DrawTexture (Rect (290,50,200,150),part1Video);
//part1Video.Play();
MyWaitFunc1();
if (part1Video.isPlaying == true){
playButtonString="pause"; //it's playing so the button should pause.
MyWaitFunc1();
}
else{
playButtonString="play"; //it's not playing and the button should play the movie.
}
if (GUI.Button (Rect (290,200,30,30),playButtonString) == true)
{
print("u pressed play button of 1");
if (part1Video.isPlaying == true){
part1Video.Pause();
}
else{
part1Video.Play();
}
}
if (GUI.Button (Rect(320,200,30,30),"Stop")==true)
part1Video.Stop();
if(dispVieo2==true)
{
GUI.BeginGroup (Rect (0, 0, 1200, 675));
if(firstWatched==true)
{
GUI.DrawTexture (Rect (290,50,200,150),part2Video);
if (part2Video.isPlaying == true){
playButtonString="pause"; //it's playing so the button should pause.
}
else{
playButtonString="play"; //it's not playing and the button should play the movie.
}
if (GUI.Button (Rect (290,200,30,30),playButtonString) == true)
{
print("u pressed play button of 2");
if (part2Video.isPlaying == true)
part2Video.Pause();
else{
part2Video.Play();
}
}
if (GUI.Button (Rect(320,200,30,30),"Stop")==true)
part2Video.Stop();
}
}
function MyWaitFunc1()
{
yield WaitForSeconds(3.37);
print("next");
part1Video.Stop ();
dispVieo1 = false;
dispVieo2 = true;
firstWatched=true;
}