Ok maybe not that dramatic, but pretty handy if you’re working with Unity Android and doing some Java plugin work.
I hadn’t really touched Unity Android specific code since setting up automatic testing of it, so a few months back I wanted to remedy that by diving in head-first with an obvious not-hello-world sort of project.
For christmas of 2011, my awesome parents had bought me a IOIO board1. I wanted to push some more boundaries of mine and do some hacking which couldn’t all be contained in an email attachment and the IOIO seemed a great start for that.
In short, the IOIO board is a small, inexpensive IO board with a USB interface and Android drivers – allowing you to connect your Android phone to it and control its 48 IO ports from software running on that phone.
Obviously I had to write that software as a Unity project and I hope I’ll get some more time to polish up the last bits of the soft- and hardware for it soonish and tell you some more about it.
Anywho, that’s enough background. Long story short, I obviously started out (after consulting the Unity documentation on how to work with the Java interface with Unity Android which I would need to access the IOIO driver) by doing some editor scripting to reduce my iteration time on the Java I needed. Wisely I predicted that my Java would be so terribly rusty that I would need a significant number of iterations.
Basically what I wanted was to get rid of the multiple steps needed for compiling, signing and assembling a Java plugin. Initially I just hacked together a perl script to reduce those steps to one line of shell execution, but that still meant more context switching than I wanted.
So I leveled up the hack by having a Unity asset post processor automatically execute the perl script whenever a Java file got imported in the plugins directory – re-routing any output from it to the Unity console.
That was really awesome. I would make a change in my Java, save it, switch to Unity and see all my horrible compiler errors right there in the console. And as this was my only Android project, I was quite happy with my hack – proceeding to kill my compiler errors and build my IOIO project.
Some friends had been poking me about cleaning up and generalising the hack a bit more and luck would have it that in my christmas vacation I spent a lot of time being sick. So I used some time here and there to clean up the Unity Android plugin builder and yesterday I pushed it to github – without any project specific bits, without perl and somewhat more user friendly.
Check it out and let me know what you think. If anything is broken or you’d like to request a change or addition, please use the github issues feature: