To place videos manually with a VideoPlayer component, follow these steps:
- Create a new Unity 3D project.
- Import the provided 54321TestVideo.mov file.
- Add a 3D Cube to the scene by going to GameObject | 3D Object | Cube.
- Select the Main Camera GameObject and, in the Inspector window, add a VideoPlayer component by clicking Add Component and choosing Video | Video Player. Unity will have noticed that we are adding the VideoPlayer component to a camera, so it will have set up the default properties correctly for us:
- Play On Awake (Checked)
- Wait For First Frame (Checked)
- Render Mode: Camera Far Plane
- Camera: Main Camera (Camera)
- Drag the video clip asset file called videoTexture from the Project window into the Video Clip property slot in the Inspector window, like so:
Figure 12.2 – The Inspector window of Main Camera showing the source Video Clip
- Test your scene.
You should be able to see the movie being played behind the scene...