How to add and play .mov file in unity project

Ananya picture Ananya · Feb 4, 2013 · Viewed 23.6k times · Source

I'm trying to add .mov file into my unity project and want to play that video file in a scene.how can i create a scene with video playing in unity 3d?

Answer

Ananya picture Ananya · Feb 7, 2013

Thanks,It was the problem with Unity Pro version.Now i'm working with Unity Pro and Videos are working properly .

U can use the following javascript after importing the video file into asset folder .

//create a MovieTexture variable

var movTexture : MovieTexture;

function Start () {

renderer.material.mainTexture = movTexture; movTexture.Play();

}

function Update () {

  if(Input.GetButtonDown ("Jump")) {
    if (movTexture.isPlaying) {
        movTexture.Pause();
    }
    else {
        movTexture.Play();
    }
}


if(Input.GetKeyDown(KeyCode.Space))
    movTexture.Stop();

}