Chapter 3. Setting Up Your Game

After the history lesson and setting up your project you must be looking forward to do some actual development. In this chapter, we'll be explaining the difference between three of the languages you can use to program in Unity, creating a basic structure for our game, creating a title screen, creating an in-game screen, and rendering a level.

Boo, C#, or UnityScript

Unity is amazing. With minimal effort you can have a prototype up and running in a few hours. No other engine has allowed such great flexibility. Another of Unity's excellent features is the ability to program in three languages, namely C#, UnityScript, and Boo. Let's go in to the pros and cons of each one, and explain which one we'll be using.

Boo

Boo is an object-oriented, statically-typed programming language that has a syntax inspired by Python. Boo has only been covered here for completeness, the documentation for programming in Unity with Boo is poor to non-existent and only around 5 percent of Unity developers actually use Boo, so finding support when you need it could prove difficult.

UnityScript

If you know JavaScript then you'll feel comfortable with UnityScript. The syntax is exactly the same; you just need to learn all the addressable objects from Unity. Both JavaScript and UnityScript support dynamic typing. This is great if you are just trying to create something quickly and don't want to worry too much with the details, but it can lead to less manageable code and dynamic typing is not supported on iOS. Some plugins, which you can buy on the asset store, will be written in UnityScript, but these will often require modification to get them running on all platforms.

C#

C# is also an object-oriented language, like Boo, but the similarities end there. C# is a multiparadigm programming language; a framework where programmers are free to work in a variety of styles, mixing constructs from different paradigms. It encompasses strong typing, declarative, imperative, procedural, functional, object-oriented and component-oriented programming disciplines. The majority of plugins you can buy on the asset store are written in C# and will work on mobile with very little code changes, if any. Unity requires that all variables are strongly typed, which means that any issues with the code will be identified within Unity and will stop you compiling until they are resolved. This makes it a lot less error prone than Boo or UnityScript, and it is for this reason that we will be writing our game, Sokoban, in C#.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.104.95