I needed to use a video that contained transparent content (aka an alpha channel) in a Unity prototype I was working on for a demo. And according to the docs, the only video formats that support transparency are a certain Apple-only format and WebM with the VP8 codec.
I couldn’t get the video to render to WebM using the editing software I had, so I ended up exporting the whole thing to a sequence of PNG files, which I then converted to WebM VP8 using the ffmpeg and the following parameters:
ffmpeg.exe -i IMG_%07d.png \
-c:v libvpx \
-pix_fmt yuva420p \
-auto-alt-ref 0 \
-c:v libvpx specifies the VP8 codec and
-i IMG_%07d.png is the matching pattern for the input files. I have no idea what the other parameters mean, and I don’t remember where I found them when I googled with DuckDuckGo.
But it worked! I followed the import instructions in the Unity documentation and it the video played with transparency on both iOS and Android. The only thing worth noting is that I had to enable the “encode” option for Android in the import settings.
Up until a few days ago I had been working on a yet-to-be-announced iOS game made with the Unity game engine, and I believe that one of the best technical decisions I had made in designing it was to use an in-process messaging system from the get-go. That decision continued to pay dividends until the very end as it helped keep the various components in the game well-separated and as self-contained as possible, which led to a code base that is more maintainable and resilient to change as it grew.
There are several messaging systems out there that are specifically built for the Unity game engine, but I decided to go with a more general purpose solution from a little gem of an open source library called TinyIoC.
This post describes the how I set up new Unity projects for use with an external VCS, which is based on the process described in the Unity documentation, but corrects a few omissions that unnecessarily include unneeded files in source control. And while I’ll be using Subversion in this example, the process should be applicable to other VCSs by changing the Subversion commands used here to their appropriate counterparts.
Unity does a great job of automatically importing Photoshop files. but it has an issue with transparency that, while easy to resolve, is poorly documented in my opinion. Here’s my attempt at writing the definitive guide on the subject.
I have Unity 3.5 and Unity 4.0 Beta installed side-by-side. So I made a set for icons for each so I can pin them to the Windows taskbar and still be able to tell which is which. Here’s what they look like in action:
Sharing is caring, and I do care. So here are the icons in case anyone wants to download them:
Unity 3.5 icons Unity 4.0 icons
The Internet is broken, and here’s proof: For a person like me, who is into game development with Unity, who is online almost daily unless someone within speed dialing distance dies, and who is hooked into the forums and the feeds and the Twitters and the Googles, for someone like that to somehow miss reading this fantastic article titled “Unity3D coroutines in detail” by one Sir Richard Fines, Esq. is a sure sign that there’s something wrong with this world. Or at least with the online portion of it.