I have this code attached to a cube with a gui texture. But it will not play! Any suggestions to what I have done wrong? Any help would be greatly appreciated.
var wwwData : WWW;
var url : String = "http://dl.dropbox.com/u/23413053/walkcyclemesh.mov";
function Start () {
wwwData = new WWW (url);
guiTexture.texture = wwwData.movie;
}
function Update () {
var m : MovieTexture = guiTexture.texture as MovieTexture;
if (!m.isPlaying && m.isReadyToPlay)
m.Play ();
if(!m.isReadyToPlay){
GUI.Label (Rect (410, 605, 100, 20), "Loading");
}
}
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();
}
// Make sure we have gui texture and audio source
@script RequireComponent (GUITexture)
@script RequireComponent (AudioSource)
Obviously the url will change. I'd put this script on the texture, yes, as it does say this returns a texture, so I'd assume that it'd return the movie to the new texture... Comment back if you need more help though.