- Home /
Is there an issue when playing a Movie Texture as a GUITexture?
Hi,
I'm having a problem playing a Movie Texture as a GUITexture. I'm using GUITexture instead of throwing the movie on a game object because I want it to be a full-screen cut scene kind of thing, rather than an in-game effect. I'm building for OSX standalone, with a fixed window size of 1024x768, and the movie (.mov) is 1024x768. When I make a build and play it, even though I set the GUITexture pixel inset to (0, 0, Screen.width, Screen.height), it plays the movie as though it is zoomed in towards the center. That is to say, it's as if it's playing the inner 800x600 pixels of the movie (based on the center point, and those are just guessed dimensions), stretched to fill the 1024x768 window. And other than this odd zooming, everything else works as I would expect it to.
Here's my code...
// variables exposed in inspector to assign the movie and audio var introMovie : MovieTexture; var introMovieAudio : AudioClip; private var gTex : GUITexture;
function PlayIntroMovie () { moviePlaying = true; // flag for external use if (audio.isPlaying) audio.Pause(); // pause regular background music
gTex = gameObject.AddComponent(GUITexture);
var movieAudio : AudioSource = gameObject.AddComponent(AudioSource);
movieAudio.clip = introMovieAudio;
movieAudio.volume = .4;
movieAudio.rolloffMode = AudioRolloffMode.Linear;
gTex.enabled = false;
gTex.pixelInset = Rect(0, 0, Screen.width, Screen.height);
gTex.texture = introMovie;
gTex.enabled = true;
gTex.texture.Play();
movieAudio.Play();
while (gTex.texture.isPlaying) yield;
gTex.enabled = false;
Destroy(gTex);
Destroy(movieAudio);
audio.Play(); // restart background music
moviePlaying = false;
}
Anyone have any idea why this might be happening, or how I can fix it?
Answer by Bunny83 · May 13, 2011 at 04:47 PM
Did you set the localScale to 0,0,0 like the docs on GUITexture.pixelInset suggest? Also after setting pixelinset don't change the transform.