Question by
ShiningOtter · Sep 25, 2015 at 12:21 PM ·
startstopmovietexture
Start a movie texture after another movie texture has ended
Hello!
I am new to Unity 5 and I'm looking for a script to start a new movie texture after the current movie texture has ended, or if the player inputs any button.
Please help!
Here is my movie texture code Note - I do have a start/stop command set to the space bar for testing purposes.
using UnityEngine; using System.Collections; using UnityEngine.UI;
[RequireComponent(typeof(AudioSource))]
public class PlayVideo : MonoBehaviour {
public MovieTexture movie;
private AudioSource audio;
void Start () {
GetComponent<RawImage> ().texture = movie as MovieTexture;
audio = GetComponent<AudioSource> ();
audio.clip = movie.audioClip;
movie.Play ();
audio.Play ();
}
void Update () {
if (Input.GetKeyDown (KeyCode.Space) && movie.isPlaying) {
movie.Pause ();
}
else if(Input.GetKeyDown (KeyCode.Space) && !movie.isPlaying) {
movie.Play ();
}
}
Comment
Your answer
Follow this Question
Related Questions
Best way to Start/Stop script during runtime. 0 Answers
Noob: Fresh install play/stop problem 0 Answers
Stop the Vehicle Engine / Start Vehicle 0 Answers
How can i disable a function in C# 1 Answer
Texture Over MovieTexture? 0 Answers