- Home /
How do you move to a next scene directly when a video stops playing?
This is my current script attached to a Plane object.
And my new scene is called "Scene 6". So how do i apply the -> Application.LoadLevel("scene6"); <-?
function Start () { renderer.material.mainTexture.Play ();}
Answer by AliAzin · Sep 02, 2010 at 09:24 AM
You can write something like this:
function Start () { renderer.material.mainTexture.Play (); while (renderer.material.mainTexture.isPlaying) yield WaitForSeconds(.1);
Application.LoadLevel("scene6");
}
THAN$$anonymous$$S AGAIN.YOU HELPED $$anonymous$$E TWICE NOW.
is it possible to contact you through msn or any form of communication other than here?to make it easier.... cause i got 1 or 2 more $$anonymous$$or-neutral problems.
Please reply asap thanks.
This is really helpful. But how function is this on Android with "iPhoneUtils.Play$$anonymous$$ovie"?
Answer by gordeszkakerek · Jan 10, 2012 at 11:09 AM
This is helpful, but how function is this on android?
Answer by crazyKnight · Jan 10, 2012 at 11:17 AM
For Android
if(Gui.Button(Rect(10,10,100,20),"Play Video")) // or any other condition on which you want to play the video
{
iPhoneUtils.PlayMovie("YourVideo.mp4", Color.black, iPhoneMovieControlMode.Hidden);
Application.LoadLevel("LevelName");
}
the moment the video stops playing the command will go to the next line and the level will be loaded.
if you get the right answer then you are supposed to rate it or mark it correct so that when others check into your question they know which answer is correct ....
you're right, i did it so, does not allow it: "You don't have permission to do this action. Please Login as another user"
Answer by bvsatish · Aug 25, 2016 at 05:34 PM
using UnityEngine; using System.Collections; using UnityEngine.SceneManagement;
public class PlayMovie1 : MonoBehaviour {
private string movPath = "The_Secret.mp4";
// Use this for initialization
void Start () {
StartCoroutine(PlayStreamingVideo(movPath));
}
private IEnumerator PlayStreamingVideo(string url)
{
Handheld.PlayFullScreenMovie(url, Color.black, FullScreenMovieControlMode.Full, FullScreenMovieScalingMode.AspectFill);
yield return new WaitForEndOfFrame();
yield return new WaitForEndOfFrame();
Debug.Log("Video playback completed.");
}
void OnVideoPlay()
{
if(Gui.Button(Rect(10,10,100,20),"Play Video"))
{
Handheld.PlayMovie("The_Secret.mp4", Color.black, HandheldMovieControlMode.Hidden);
SceneManager.LoadScene (sceneName);
}
} }
Completed the video go to next Scene
Your answer
![](https://koobas.hobune.stream/wayback/20220613072535im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
LoadLevel Doesn't have script 1 Answer
I can't play anyother video format than mpeg4 w/ MovieTexture 0 Answers
Are MovieTextures a feature of Unity Pro? 0 Answers
How to keep certain information when reloading a level 8 Answers
How to prevent a script from running until the scene is loaded? 2 Answers