Saturday, February 18, 2012

Code Quality on the rise: How to create better applications in Unity 3

With the days of small games and applications generating enough revenue to make a living from them being gone, even in the mobile space, its unavoidable that our projects grow in size and often also in code complexity. But unfavorably for us, Unity is not exactly helpful when it comes to maintaining code quality and ensuring that regression is prevented. This is caused by different aspects, but the largest ones are that the debugger tends to have some more or less ugly problems, by Unity Technologies refusal to finally provide mdb files to include their own closed source in proper debugging and by the lack of proper unit testing support.

While the first two problems are completely out of our control, at least unless we license the source version of Unity, the unit testing problem can finally be approached, thanks to Test Star, a Unity extension available at a fee of $50 on the Unity Asset Store.

Test Star combines the benefits of the nunit testing framework, in a modified version to run, with Unitys editor focused approach, building upon this to even allow you to unit test your scenes and runtime behavior, not only code with 'in and out' parameters. Instead of wasting time with a long text on how it works and why its great to use it, I would like to point you to a little video on YouTube that shows it in action:
What I personally love about it is that its error reporting is much more sophisticated than Unitys own integrated one which pretty commonly lacks proper information on what went wrong, replacing it with a generic and basically useless error.

I've decided to write this blog after using and experiencing it myself for quite some time now and I can only recommend to EXPERIENCE IT yourself if you are looking for a way to rise your application or games quality.
I've never been disappointed by it, but the biggest gain so far from it was on a project where I had to port a whole host of DB functions and a DB management class from MySQL to SQLite which without Test Star would have taken multiple times as long as it did in the end due to Unity eating away proper errors, hidding them or simply crashing when Test Star was not handling it, while Test Star gave me precise informations on what went wrong.

No comments: