Video Playback in Unity

Source: Internet
Author: User

Suddenly, I thought about what it would be like to play a video on a cube object. Today, we finally have time to try it out. Result => succeeded.

The detailed steps are as follows:

Preparation phase:

1. Unity pro edition => genuine edition required (of course, the cracked version is OK, you know ).

2. Install QuickTime player. Must be installed. Otherwise, unity will automatically report an error when importing movie resources.

3. Install the formatting factory software => movie format conversion. Other tools are also OK. Here, the format is converted to mov by default. M after Avi conversion is about 7 m.

======================================

Operations in Unity

1. Drag a movie resource in mov format to the Assets Directory. [Note: it may take one or two minutes, and unity is in the suspended state, which may be the cause of excessive resources.]

2. Create a cube object with a central 3d stereoscopy. Create a light.

3. Drag the imported movie resource to the Cube object. Make sure that the Renderer component exists on the cube object. If not, manually add one.

4. Add an audio source component for the cube object and select the imported movie audio file as the sound source.

5. Add a script to the Cube object. [the script hangs on any object].……

Public class playermovie: monobehaviour
{
Public movietexture; // movie texture
Void start ()
{
This. Renderer. Material. maintexture = movietexture;
Movietexture. Play ();
}
}

6. Return to the unity scenario, drag the movie resource to the movietexture in the script, and set play on awake to start playing. Of course, it can also be controlled through the GUI.

Last one:

Another 3D version:

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.