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 ();}
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 ();}
You can write something like this:
function Start () {
renderer.material.mainTexture.Play ();
while (renderer.material.mainTexture.isPlaying)
yield WaitForSeconds(.1);
Application.LoadLevel("scene6");
}
This is helpful, but how function is this on android?
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.
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