September 28th, 2012 by Anthony Capobianchi
Here at Infrared5, a good portion of our projects are based in Unity 3D. Needless to say, with the introduction of Unity 4, I was very interested in what had changed about the coming engine, and why people should make the upgrade. This post will look at few of the features of Unity 4 that I am most excited about.
The New GUI
The first time I sat down with Unity almost a year ago to work on Brass Monkey’s Monkey Dodgeball game, I knew practically nothing about the engine. That didn’t stop me from being almost immediately annoyed with Unity’s built in GUI system. Positioning elements from the OnGUI was a task of trial and error, grouping objects together was a pain, and all the draw calls that it produced made it inefficient to boot. At that time, I was unaware of the better solutions to Unity’s GUI that were developed by third party developers, but after I was made aware, I was confused as to why such a robust development tool such as Unity didn’t have these already built in.
Though the new GUI system is not a launch feature for Unity 4, Unity is building an impressive system for user interface that will allow for some really interesting aesthetics for our games. From the looks of it, the new system seems to derive from Unity’s current vein of GUIText and GUITexture objects. The difference is in the animation capabilities of each element that is created. You are now allowed to efficiently have multiple elements make up your GUI objects such as buttons, health bars, etc. Unity then allows you to animate those elements individually. Not to mention that editing text styles in the GUI is now as easy as marking it up with HTML.
One of the coolest additions is the ability to position and resize any UI element with transform grabbers that anyone who has used an Adobe product would be familiar with. This also allows for the creation of rotating elements in 3D space, which allows for creating a GUI with a sense of space and depth to it. This can lead to some really interesting effects.
The new GUI system will come packaged with pre-built controls, though there is no word as to whether or not those controls will be customizable. Unity lists one new control as a “finely tuned thumbstick [controls] for mobile games”. A couple of months ago, I developed my own thumbstick like controls to maneuver in 3D space, and it was a pain. Hopefully these new controls will make it a lot easier. You can also easily create your own controls by extending from the GUIBehavior script. Developers should have no problem creating controls that handle the specifics of their own games.
Every image that you use to create your elements gets atlases automatically. This is a huge bonus over the old GUI system. The biggest problem Unity’s GUI system has right now is the amount of draw calls it makes to render all those elements. Third party tools like EZGUI and iGUI rely on creating UI objects that atlas images to reduce draw calls. It will be nice to have that kind of functionality in a built in system. I’ve spent a lot of time developing user interfaces in Unity over the past few months, so it makes me really excited to see that Unity is trying to correct some of their flaws for creating a component that is so important to games.
Unity’s current animation system is pretty basic- add animations to an object and trigger those animations based on any input or conditions that are needed. The animation blending was useful but could have been better. With Unity 4, it is better. Introducing the Mecanim: an animation blending system that uses blending trees for models with ridged bones to fluidly move from one animation to another. One of the biggest hurdles that we as developers need to overcome in projects that deal with a lot of animations is transitioning from those animations as seamlessly as possible. Not always easy!
Along with blending the animations, Mecanim allows you to edit your animations similar to how you would edit a film clip to create animations loops. Mecanim also supports IK, so for example it can change the position of a characters feet on uneven surfaces, bend hands around corners, etc. A couple of years ago I was fascinated by Natural Motion’s Endorphin engine for animation blending. Mecanim may not be as sophisticated as Endorphin, and only supports biped skeletons, but it seems like an incredible system that comes built in to Unity.
The best part is about this is that once you create a blend tree for your animations, you can drag and drop it onto another rigged model, and it will work even if the new model is a different size or proportion.
The mobile scene is really where Unity shines. Most of the Unity projects I have worked on for Infrared5 have had some sort of mobile component to them. The mobile platform is going to get even better with Unity 4. The most interesting thing from a developer’s standpoint is the profiling system, which allows you to view your game’s GPU performance to determine where it runs smoothly, and where it needs more optimization. The addition of real-time shadows for mobile is a nice added bonus. It will definitely add a lot of aesthetic value to the products we make.
Unity 4 is going to hit the industry with amazing force. I, for one, cannot wait to get my hands on this engine and am already filled with ideas on how I want to utilize these new tools. My favorite part is going to be the mobile optimization. Mobile development is huge, and it’s not going anywhere anytime soon. With all the new capabilities of Unity’s mobile content, I should be kept interested for quite a while.