- Home /
downloding movie texture
i want to download the movie and audio file when running the game from a server with url address i do not want to save the movie and audio file in my development file i want to download it from sever or a url address while running the game and i want to see the progress of movie and audio file download to my game while playing is it possible any alternate option is available in java script.in the below code i am using movie file directly from my my project file instead of that i want to use the movie file from the server or url during run time of game instead of saving in my project file.Thanks in advance
var renplane : Renderer; var movtex : MovieTexture;
function Update()
{
movtex.loop = true;
renplane.renderer.material.mainTexture = movtex;
movtex.Play();
}
Answer by Ringhino · Mar 11, 2011 at 02:23 PM
Try With this script from Manual
var url = "http://www.unity3d.com/webplayers/Movie/sample.ogg"; function Start () { // Start download var www = new WWW(url);
// Make sure the movie is ready to start before we start playing var movieTexture = www.movie; while (!movieTexture.isReadyToPlay) yield;
// Initialize gui texture to be 1:1 resolution centered on screen guiTexture.texture = movieTexture;
transform.localScale = Vector3 (0,0,0); transform.position = Vector3 (0.5,0.5,0); guiTexture.pixelInset.xMin = -movieTexture.width / 2; guiTexture.pixelInset.xMax = movieTexture.width / 2; guiTexture.pixelInset.yMin = -movieTexture.height / 2; guiTexture.pixelInset.yMax = movieTexture.height / 2;
// Assign clip to audio source // Sync playback with audio audio.clip = movieTexture.audioClip;
// Play both movie & sound movieTexture.Play(); audio.Play(); }
Your answer
Follow this Question
Related Questions
www.texture memory leak 1 Answer
Image Effects on MovieTexture 0 Answers
The best way to deal with thousands of textures/pictures offline 0 Answers
Is WWW.movie supposed to be this slow? 2 Answers
Where is downloaded things from editor script being saved? 0 Answers