Playing videos by manually adding a VideoPlayer component to a GameObject
If you want complex animated materials in your games, you can play video files as texture maps – for example, you can simulate TV sets, projectors, and monitors by playing a video on their virtual screens. In this recipe, we will learn how to add and use VideoPlayer components to the Main Camera GameObject. By default, the Main Camera fills the entire visible game window and has a renderer component, making it an ideal location for adding a VideoPlayer component when we want the video images to fill the whole screen.
Getting ready
If you need a video file so that you can follow this recipe, please use the 54321TestVideo.mov file included in the 14_01 folder.
How to do it...
To place videos manually with a VideoPlayer component, follow these steps:
- Create a new Unity 3D project.
- Import the provided
54321TestVideo.movfile. - Add a 3D cube to the scene by going to GameObject...