- Home /
How do I play a full screen video?
I would like to have a video play in full screen on a trigger.
Anyone know how to do it?
from: http://unity3d.com/unity/features/audio-and-video
3D Audio and Video Play back video on any surface in your game, or directly in full-screen. Sync or syncopate audio and video.
I assumed this was a little more straight forward.
Answer by baha · Mar 06, 2010 at 01:09 AM
I think you may want to draw a GUI Texture with the size of the screen and asign the movie texture to it with a scale mode = stretch to fill, use the following ( i guess) :P
GUI.DrawTexture(Rect(0,0,Screen.width,Screen.height),MovieTexture,ScaleMode.StretchToFill);
then play the movie texture using MovieTexture.Play();
you may also want to set Screen.fullScreen = true;
and hide the cursor using Screen.showCursor = false;
and when Escape is pressed and released you may want to re-show the cursor and minimize the screen to its original location:
function Update() {
if (Input.GetKeyUp(KeyCode.Escape)) {
Screen.showCursor = true;
Screen.fullScreen = false;
// in webplayer the fullscreen mode is automatically escaped when "Escape" is pressed
}
}
Answer by jester · Dec 13, 2009 at 06:04 PM
i can't test this since i don't have unity pro (so apologies if i'm answering out of turn), but this page tells how to set it up:
http://unity3d.com/support/documentation/Manual/Video%20Files.html
you should be able to create a new camera and a cube off screen from your main camera. scale the cube to fill the screen space of the new camera and attach the movie texture to it. when your trigger script fires off, disable the main camera and then activate the new camera. through that same script, tell the movie to start playing. that should get you an full screen cutscene effect.
To let your player run in full screen, set Screen.fullScreen to true.
Answer by pkamat · Dec 13, 2009 at 06:00 PM
Humm just a shot in the dark, I would create a plane with a movie texture and place it right in front of the camera. here is the pseudo code.
On each tick - Convert screen pos (width/2, height/2) to world position using ScreenToWorld() - translate the plane with the texture to the world position above - set plane direction to -camera.forward
so no matter where how the user moves he will always see the video in front of him :)
hope its clear...
I don't think this is a good idea. Even if you wanted to keep a plane in front of a moving camera, it would be a better idea to just parent the plane to the cam, rather than keep updating its position via code. But really, you should consider using a 2nd cam, or one of the GUI methods of displaying a texture on-screen. (will write a fuller answer if time permits)
Answer by amr nasr · Jul 26, 2010 at 09:51 PM
Can you write the full script please?
UnityAnswers helps those who help themselves. Try the suggestions, read the documentation, poke around, learn some things. If it doesn't work, post pieces of what you have and ask more questions. Rinse and repeat.