In recent weeks I have spent a bit of time with Unity3D, physician the middleware package that gets a lot of acclaim — and deservedly so, I must say. Those of you who have followed me for some time, or know me, are aware that I am always very outspoken about issues I see in the things I do or work with. Whether it’s been my criticism of Qualcomm’s operations during the BREW era, whether it’s been Hollywood studios’ approach to DVD and Blu-Ray, or things such as the Kindle. When I see problems, I address them and offer up constructive criticism, because oftentimes I do have workable solutions to offer. The fact that on various occasions my comments have lead to actual change, shows me that my attempts not to be unreasonable have been successful. I usually just point out things where I have the distinct feeling that someone simply didn’t think things through.

The truly curious thing about my working with Unity3D so far is that I have not a single complaint. This is by far the most complete, reliable and comprehensive middleware package I have ever seen and I have yet to find an area where the package is weak or has true shortcomings. Sure, it is inevitable that the package won’t do exactly what I want all the time, but that is the nature of the beast. On the whole, however, you can tell that Unity3D has been put together who understand the subject matter, knew what they were doing and what developers need. There don’t seem to be a whole lot of useless because-we-can features and all the areas I have touched upon so far in my tests have all been thoroughly thought out with interfaces that are precise and complete. As a software developer one really can’t ask for more. And to think that the basic version of Unity3D is actually free… it truly boggles the mind.

When I started playing around with Unity3D one of the first things I had to decide was whether I wanted to program in JavaScript or C#. I’ve been working with JavaScript over the years, porting countless J2ME games to BREW, but somehow it never really clicked with me. I had never worked in C#, though I had heard some good things about it. Looking over it briefly it seemed very similar to C++, the language I’ve been using most for the past 20 years or so. It was that similarity that made me decided to use C# in the end.

Ironic, I know. Me, using a programming language developed by Microsoft… ah well, the world is full of surprises. But in all honesty, so far C# has been pretty good to work with. There are few things that I do not particularly like, instances like the lack of static array initialization, where the language has taken a few steps backwards as opposed to forward, but on the whole, it’s been cool and fun to work in C#. The main problem I have with it – and that’s really just a minor gripe – is that I think it is too user friendly. The language makes it possible to implement certain things in a very quick and easy manner, making it seem super-cool, but if you look under the hood, you realize that a tremendous code overhead has to be generated to make that functionality possible. Therefore a single two-line code snippet may result in brutal code bloat and a serious performance sink without the programmer ever suspecting it at first.

This is not C# problem, though. It is a trend that most modern programming languages have been following – including Java and JavaSCript – and while it seems great at first, to me as a down-to-the-wire programmer who used to count CPU cycles for a living in assembly coding, it is really the wrong way to approach programming. Most of today’s software is clearly evidence of that. Just look at the resource hogs that simple applications like word processors have become. It is not because they have so many more really cool features, but because their implementation is just totally shoddy.

But I digress…

So, I’ve been doing some work in Unity using C#. I’ve never been big on 3D programming. It’s never been something I was particularly interested in, but imagine my surprise when it took my no more than a few minutes to actually script a simple 3D application in Unity. A few hours later I was able to actually have a scene with some user control. This is hard core. There was virtually no learning curve to that point and what really took me the longest was looking up the C# syntax for what I wanted to do, because as it turned out, in the details, C# is quite a bit different than C++.

There is a learning curve, of course. No middleware could be without. It is the nature of the beast, but the fact hat it took me virtually no time to jump in and do things in Unity showed me that this was very well thought-through, because the API made sense from the get-go, and Unity’s naming convention is clear and to the point. No guesswork involved.

As I expanded my tests and began to do a little more specific programming, I had to spend some more time reading the documentation, but it was always a very clear process and I never had the sense of being overwhelmed – despite the fact that Unity3D has such a wealth of functionality that it could make your head explode.

Over the past week or so I ran into a small problem. I was doing some GUI programming and had planned to do some fancy visual effects with texture blending, only to ind out that Unity’s GUI class is somewhat limited — a lot actually. Some of the functionality I was looking for is simply not there. I tried to dig deeper but everywhere I looked the tenor was that Unity couldn’t do it, so I decided to look at NGUI, one of the third-party packages that is available. But just as I was playing around with it, a work-around for my problem came to my mind. so I switched back to my original project and tried it out, and indeed, I had found a working fix to draw GUI elements, using different shaders. This was a relief because I would not have to rewrite what I had done so far and could simply continue down the path I was going.

Even though this immediate problem has been solved, I now run into the problem that I would like to render a 3D object in front of the GUI, and Unity does not immediately allow me to do that. So, it’s time to figure out another work-around for this.

As you can see, there are still a few things I need to figure out and get to work, but I am hopeful. Perhaps, I will decide to use NGUI, after all, when everything is said and done, if only because it might allow me to get certain tasks done in an easier fashion. I haven’t decided yet, and that is what makes Unity so great and so much fun to play around with.

Facebooktwittergoogle_plusredditpinterestlinkedinmail