PNG sequence to WebM video with transparency

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:

Where -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.

 

Lightweight messaging in Unity with TinyMessenger

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.

Continue reading

Correctly using external Version Control Systems with Unity

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.

Continue reading

All there is to know about Unity coroutines

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.