Reputation: 345
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?
Upvotes: 2
Views: 27566
Reputation: 345
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 .
var movTexture : MovieTexture; //create a MovieTexture variable
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();
}
Upvotes: 1
Reputation: 1880
Do not forget to install QuickTime if you are using Windows for development. Otherwise, you will not be able to import *.mov file into your project. Here is small instruction how to import and play video in Unity3d: http://druss.co/2015/05/unity3d-how-to-play-video-in-unity-project-movietexture/
Upvotes: 1
Reputation: 5918
Yes, what you can do, if you have Unity Pro, is use Movie Textures.
Movie Textures are animated Textures that are created from a video file. By placing a video file in your project's Assets Folder, you can import the video to be used exactly as you would use a regular Texture.
If you do NOT have Unity Pro, then you are out of luck unless you want to try using one of the methods outlined in this answer, however I would not recommend that because of poor performance.
Upvotes: 0