Independent Learning: Kevin Zsitvay
- by Kevin Zsitvay
- December 16
- in
For my final project, I had to learn about Movie Textures. Movie Textures are very similar to normal textures. However, the texture is a video file that you can just simply drag on to an object such as a cube. This sounds easy and all, but it wasn't.
I had pulled videos that I wanted to use in my Unity scene, 6 of them. All of the videos were ranging in size and quality. First attempt at dragging one of the videos into my assets, Unity crashed. The second attempt, Unity crashed, and so on...
After a lot of research, the solution to the crashing was converting all of the videos into .ogg format which works perfectly in Unity. Thankfully, all of the Macs in Newhouse had VLC installed, which I used to convert all 6 of my videos. After all the conversions, I was able to get all of the videos into my unity project and then drag them onto the different objects.
Next came the scripting. There were tons of different scripts online that would play the videos, but I didn't want them to all play at once. Thankfully, Unity themselves had some code that did what I wanted but not completely. Their script had the video play when I would click in spacebar, but I didn't want every video to play at one.
The solution? I created 6 different scripts, one for each of the videos. I also created 6 new "inputs" which basically are controls for a video game. For example, in FIFA, there is an input 'pass' which is bound to the A button or input 'shoot' which is bound to the B button. I assigned the number keys (1-6) to their own actions of play1, play2, etc... I modified each of their scripts so that when 1 was pressed video 1 would play, and when 2 was pressed video 2 would play and so on...
Overall, it wasn't the easiest thing to do but it was definitely rewarding when it was all up and running!
http://docs.unity3d.com/Manual/class-MovieTexture.html
COMMENTS