Movie Textures

From ETC Public Wiki
Revision as of 18:27, 15 November 2011 by Waikayk (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Movie textures will mostly be dealt with by programmers, however there are some things you need to know.

Unity imports movie files via Apple Quicktime. That means that Unity will only play what Quicktime can play.

Accepted file formats are: .mov, .mpg, .mpeg, .mp4, .avi, .asf files.

This also means that Quicktime needs to be installed on a Windows machine, found here: http://www.apple.com/quicktime/download/

  • Guaranteed to work export settings:
Format: QuickTime
Codec: H.264
Square Pixels

To apply a movie texture to an object, it is as simple as dragging and dropping a regular texture. After the Texture is applied, as a programmer you can gain access to your material by storing it as a Movie Texture Variable. The main functions of this class is

.isPlaying a boolean to state whether or not the video is playing
.Play() a function to start playing of the video
.Pause() a function to pause the currently playing video

MovieTexture video;
void Start () 
{
    video = renderer.material.mainTexture as MovieTexture;
}

void Update()
{
    if(!video.isPlaying)
    {
      video.Play();
    }
}

Sound does not play automatically. Be sure to make a call to play the sound the same time the video starts.

Additional information can be found here: http://unity3d.com/support/documentation/Components/class-MovieTexture.html

And Movie Texture Scripting information can be found here: http://unity3d.com/support/documentation/ScriptReference/MovieTexture.html