- Home /
Question by
latinoheat112 · Feb 02, 2013 at 05:52 PM ·
c#errorloopmovietexture
Unity3D MovieTexture Loop
Actually I'm Creating an Intro cutscene in the Game I have created it and scripted it , But when the movie finishes the the movie loops and plays with laggy music.. any Ideas how to solve that, BTW. I have created another cutscene which have another Movie And it works perfectly when the duration finishes the movie ends and teleports into the other scene
----------
my code
using UnityEngine;
using System.Collections;
[RequireComponent (typeof(AudioSource))]
[RequireComponent (typeof(AudioListener))]
public class MoviePlay : MonoBehaviour {
public MovieTexture movie;
private float _movieTimer;
void OnGUI() {
GUI.DrawTexture(new Rect(0,0, Screen.width, Screen.height), movie);
movie.Play();
if(Input.GetKeyUp(KeyCode.Space) || movie.duration <_movieTimer) {
movie.Stop();
Application.LoadLevel("Menu");
}
}
void Update () {
_movieTimer += Time.deltaTime;
}
}
Comment