1. Getting Started
Unity is a cross-platform 2D and 3D game development system developed by a company called Unity Technologies (originally named Over the Edge). What does it mean to call Unity cross-platform, exactly? Well, its cross-platform in the sense that the Unity Editor, the game creation and editing tool that is the centerpiece of Unity, runs on macOS and Windows. More impressively, Unity is cross-platform in the sense that using the Unity Editor you can build games for macOS, Windows, web browsers (using Flash, Google Native Client, or Unitys browser plug-in), iOS, Android, and game consoles. And the list keeps growing.
As for 3D, Unity is a 3D game development system in the sense that Unitys built-in graphics, sound, and physics engines all operate in 3D space, which is perfect for creating 3D games. Unity can also be used to create 2D games; in fact, many successful 2D games have been developed in Unity.
This book describes the latest version of Unity as of this writing, which is Unity 5.6.2, but Unity is a fast-moving target, with new features and user interface changes appearing even in minor releases. This caveat applies to everything, of course, including products, licenses, and prices from Unity, Apple, and third-party vendors.
Prerequisites
Before the fun part, which includes learning how to use the Unity Editor and build games, you need to download Unity and install it. Although youll spend the first several chapters working with step-by-step examples in the Unity Editor and not get into iOS development until later (by the way, iOS originally stood for iPhone Operating System but now includes the iPod touch and iPad), its not a bad idea to get started on the iOS development prerequisites, too.
Prepare Your Mac
For iOS development, youll need a Mac running the Lion or Mountain Lion version of macOS (10.9.4 version and Xcode 7.0 or higher). Unity 5 can still run on some older versions of macOS, like Snow Leopard, but Lion and Mountain Lion will need the latest version of Xcode, the software tool required by Apple for iOS development. Typically, the latest or a fairly recent version of Xcode is required to target the latest version of iOS .
Register as an iOS Developer
Its worth visiting the Apple developer site to register as an iOS developer as soon as possible since the approval process can take a while, particularly if youre registering a company. First, youll need to register on the site as an Apple developer (free); then, youll need to log in and register as an iOS developer ($99 per year). This is required to deploy your apps on test devices and to submit those apps to the App Store.
Download Xcode
Although you wont need Xcode until you reach the iOS portion of this book, you can download Xcode now from the Mac App Store (just search for xcode ) or from the Apple developer site at http://developer.apple.com/ . When you start building Unity iOS apps, Ill go over the Xcode installation in more detail.
Download Unity
To obtain Unity, visit the Unity web site at http://unity3d.com/ and go to the Download page. There you will find a download link for the latest version of Unity (at the moment, Unity 5.6.2) and also a link to the release notes (which are included with the installation). There is even a link to a list of older versions in case you need to roll back to a previous version of Unity for some reason.
Tip
While youre on the Unity web site, take a look around. Check out the demos, the FAQ, the feature comparisons among the various licenses, and the support links to the documentation, user forum, and other community support sites. Youll certainly have to come back later, so you might as well figure out where everything is now!
There is only one Unity application, but depending on your needs, you can subscribe to different licensing models (Person, Plus, Pro, or Enterprise).
Unity version numbers are in the form major.minor.patch . So, Unity 5.6.2 is Unity 5.6 with an incremental upgrade to Unity 5.5, with a couple of bug fix updates. Major upgrades, such as Unity 4 to Unity 5, may require changes to the project.
Tip
In general, once a Unity project has been upgraded, it may become incompatible with older versions of Unity. So, its a good idea to make a copy of your project before upgrading it, just in case you need to revert to the previous version of Unity.
To start the Unity installation process, click the download link (as of this writing, its the Try Personal button). The file is about 1GB in size, so the download might take a while, but youre on your way!
Install Unity
The Unity download file is a download installer, which at this time is a file named UnityDownloadAssistant.
Run the Download Assistant
Double-click the Unity Download Assistant icon to start the Unity installation (Figure ).
Figure 1-1.
The Unity Download Assistant
The installer will proceed through a typical installation sequence (the steps are listed on the left side of the installer window), and at the end, a Unity folder will be placed in your Applications folder.
Tip
If you happen to be upgrading from an older version of Unity, this process will just replace that old version. If you want to keep the previous copy, rename the old folder first. For example, if youre upgrading from Unity 4.5 to Unity 5, first rename your Unity folder to Unity45 before performing the new installation. Then you can run both versions of Unity.
The Unity installation folder contains the Unity application and several associated files and folders (Figure ).
Figure 1-2.
Unity installation folder
The most important file in the Unity installation folder, and the only one you really need, is the Unity app, which provides the environment used to construct your games. This app is sometimes more specifically termed the Unity Editor, as distinct from the Unity runtime engine or Unity Player, which is incorporated into final builds. But usually when I just say Unity, the context is clear (I also refer to Unity Technologies as Unity).
The Documentation folder contains the same User Manual, Component Reference, and Script Reference viewable on the Unity web site (on the Learn tab). Each of these files can be opened in a web browser from the Unity Help menu, and you can always double-click Documentation.html directly to see the front page of the documentation.
The Standard Packages folder contains several files with the .unityPackage extension. These Unity package files each hold collections of Unity assets and can be imported into Unity (and from Unity, you can export assets into a package file).
The MonoDevelop app is the default script editor for Unity and is a custom version of the open source MonoDevelop editor used for the Mono Project, known as Mono for short. Mono is an open source version of Microsofts .NET Framework and forms the basis of the Unity scripting system.