- Home /
Loop Video forever
hello,
i have been looking for a script that will loop the video. I am learning scripting, please bare with me
here is the code i found
var movieTexture : MovieTexture;
function Start() {
movieTexture.loop = true;
renderer.material.mainTexture = movieTexture;
movieTexture.Play ();
}
but it is not working for me. do i need to change the naming connection.
I'm experiencing the same problem please paste the working code for looping movie texures. Ive tried every combination but can't get it to work.
Answer by liszto · Nov 10, 2012 at 01:16 AM
This must work :
var movieTexture : MovieTexture;
function Start() {
movieTexture.loop = true;
renderer.material.mainTexture = movieTexture;
movieTexture.Play ();
}
Really strange that this doesn't work for you Oo
did you specify your video in the public field of your script ?! In the Unity inspector ?
"did you specify your video in the public field of your script ?! In the Unity inspector ?"
Could you explain to me how you would do this?? I am learning not sure what it is I have to do.
What I have done is made a plane, made a material for it, and than assigned the video to it and that is it. I copy and paste the script you have given me, but it does not work. It gave me errors.
also if i have a sound with my video, it does not play it at all. so i took the audio, and rendered it separately. I have attached it to the plane, bye when I play it it is not in sync.
put the script on your camera and on the right side when you click on your camera you must see a empty field to drag/drop your video.
For the sound can you show me your script you probably do a mistake. Just show me.
var movieTexture : $$anonymous$$ovieTexture;
function Start() { movieTexture.loop = true; renderer.material.mainTexture = movieTexture; movieTexture.Play (); }
I got this code to work, but the audio is playing out of sync.
I am also using this java script as a movie to play before the game starts. and on both the audio is not playing corectly. Is there a specific file structure I need to render the Video.
function Start () {
renderer.material.mainTexture.Play(); }
function Update(){ if(!renderer.material.mainTexture.isPlaying) Application.LoadLevel(1); }
Sorry I can't explain my script right now but you can find here how I read my video in one of my games :
Hope you gonna understand it. If you have some questions, ask them. I'll be back :)
Answer by absolutegames1 · Jul 09, 2013 at 05:21 PM
// this line of code will make the Movie Texture begin playing renderer.material.mainTexture.Play(); renderer.material.mainTexture.loop = true;
Your answer
Follow this Question
Related Questions
How to pause a video automatically? 1 Answer
Video Texture Loop 2 Answers
Video Texture Loop on TV 0 Answers
How to loop a video texture in C# 1 Answer
How to play loop an audio clip on button hold down? 2 Answers