You Should Consider Unity 3

Posted on 16 October, 2011


As a long time iDevBlogADay reader (and writer) I noticed that most game programming related posts revolve around Cocos2D. This comes at no surprise since indie game devs prefer simpler 2D games and Cocos2D is the perfect fit. However, there is another strong contender available – Unity 3, although a 3D gaming creation tool, it can be very well used for 2D games too (as the excellent article series from Tim Miller showed).

About Unity

At its core Unity is a game development tool. It is available for Mac and Windows. Using a single code basis, a game can be exported to various platforms including iOS, Android, PC, Mac, Web (also PS3, Xbox and Wii). The basic version is free of charge and allows the creation and royalty free distribution of PC, Mac and Web games. The iOS export component costs 400$ (other components are priced differently). There is also a “pro” version available for Unity itself and the iOS and Android components featuring some nice goodies like advanced audio filters using FMOD, advanced rendering techniques, profiler, custom splash screen and so on.┬áThe interesting thing about iOS export is that it creates an Xcode project that can be customized further. Here is a feature comparison:

Unity’s core component is the interactive editor where game objects are placed and enriched with behaviour. This is one of the main differences between Unity and Cocos2D. Instead of writing long wounded code to build the game logic and object behaviour, you create small scripts (written in JavaScript, C# or Boo (Python dialect)) which deal with the attached object only. I find this a nice way to organize behaviour which goes well with the OOP way of thinking.







The base building blocks in Unity are “Game Objects”. In their most basic form these can be just flat planes with attached textures and an orthogonal camera pointed at them (think of a 2D side scroller). Game objects have a range of properties which can be accessed from the attached scripts and changed in the editor.






A game is divided in scenes and these can be seen as distinct levels. Using a “game manager” script, scenes can be loaded when specific events occur (like a figure hitting the end of the level and triggering loading the next level). The cool thing about Unity is the play function. While developing games you can start the game directly in Unity and see how it behaves. Even if it is an iOS game, the simulator is only concerned with the game view and works well for the purpose of play testing. What’s even cooler is the fact that object variables can be modiefied on the fly. Any object property (position, size, material, physics interaction, …) and variables exposed through scripts can be changed and the results are shown in real time.
Another nice touch are the “Maya Style” navigation controls. So if you are used to Maya (and Blender since it also supports Maya control scheme), you will feel right at home.

But game objects would be boring if there were no way of templating them. This is were prefabs come in. Simply put, prefabs are templates for game objects. They are very useful because any game object/prefab can be instantiated/destroyed through the attached scripts. Imagine an enemy type created as a prefab that is instantiated 100 times. One small change to the prefab and all enemyes adopt the change.

Unity also provides a powerful animation system. Common properties can be changed and animated using discrete points in time.






Unity features many more advanced components and materials. Lightning is a big topic and can be customized very much. Since we want to focus on 2D games first, I don’t have a deeper understanding in this area.

Another strength of Unity is its thorough documentation. Not only has every variable a code sample, but it is also provided in all supported languages (JavaScript, C# and Boo)!



Unity implements the “Asset Store” that looks and works exactly like the App Store. Plugins and addons can be purchased through it and added directly to your project. While learning Unity I found “2D Toolkit” to be quite useful for quick sprite animations.






Conclusion and Reading Tip

Unity is a great game development tool that basically comes at no cost. It can be used to quickly prototype game ideas using simple objects way before game designers start to think about the artistic style or even the story. There are many well known games on the App Store that use Unity (the most actual beeing Shadow Gun).
Since we have yet to publish our first Unity game, I am a bit concerned that the missing profiler will make it hard to stay below the 20 MB limit for OTA App Store downloads. Other than that I would recommend Unity to any developer looking to prototype and build games.

A very pragmatic book I worked with is “Unity 3 Blueprints” by Deep Pixel. You create four games from scratch (graphics are provided) and learn how everything fits together – especially the very powerful scripting system.


That’s it for today’s post. Have fun with Unity (we do) :)


3 Responses to “You Should Consider Unity 3”

  1. Toni Sala
    Oct 16, 2011

    Nice article. I’m considering to move from cocos2d to unity, basically for the multiplatform capabilities.

    However, learning a new tool and the 20 MB issue are the main cons. Money is also and issue…

    Thanks for sharing!

  2. admin
    Oct 17, 2011

    You could also shell out 3000$ and have the pro version :)
    However, Unity seems to be very cool and worth the price.

  3. Tim Miller
    Oct 17, 2011

    Thanks for mentioning my 2D tutorial series. And good timing too because part 3 just went live: