Book Image

Unity iOS Essentials

By : Robert Wiebe US
Book Image

Unity iOS Essentials

By: Robert Wiebe US

Overview of this book

<p>Unity is the perfect tool for creating games for a number of platforms. Whether it&rsquo;s for the iPhone, iPod Touch, iPad, or some combination of the three, this book takes a practical approach which maximizes performance while maintaining maximum compatibility across the entire mobile device line up.<br /><br />Unity iOS Essentials takes you through all aspects of Unity 3D game development for iOS. Mobile game development means thinking about mobile performance, multiple device screen resolutions, deploying a single application to multiple devices, understanding .NET integration, taking advantage of advanced lighting and culling systems, and integrating a mobile game with a server back end. This comprehensive book on developing Unity 3D games for iOS covers it all and demonstrates the concepts using practical tips, scripts, shaders, and projects.<br /><br />Learn how to plan for supporting multiple iOS devices before you start writing your first script. Consider performance and advanced game topics that will speed up your game development while solving real world problems. Add GUIs, use sophisticated .NET programming concepts, and examine scripts and shaders, interact with servers, and interact with projects that deal with real issues. Unity iOS Essentials provides you with a fully illustrated and fully commented guide for realising your game idea using advanced concepts that work on the iOS family of mobile devices.</p>
Table of Contents (15 chapters)
Unity iOS Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface

Understanding iOS SDKs and target platforms


When we install an iOS SDK from Apple, it's a unique experience. Apple has decided that they only want us to have the latest SDK on the most recent version of Mac OS X. This is far from the typical experience you may have had with other platforms, or multiple SDKs being installed simultaneously is the norm.

It is possible, and supported by Apple, to have multiple SDKs, but it is not very practical. For example, we could do the following:

  1. 1. Use System Update to install the latest version of Mac OS X.

    Note

    If we skip the step of installing the latest version of Mac OS X, it is more than likely that the iOS SDK installer will refuse to install the latest SDK until we have installed the latest version of Mac OS X, so we'll just make that assumption and do it.

  2. 2. Download the latest iOS SDK.

  3. 3. Install the latest iOS SDK.

  4. 4. Notice that the installer removed the previous iOS SDK.

  5. 5. Use out Time Machine backup to restore the previous SDK.

But that is not what Apple want us to do, and really, it's not what we want to do either. There may be some exceptions, but for the most part, we want to jump on the Apple bandwagon and recognize that deploying our game using the latest and greatest SDK is indeed the correct thing to do.

So, what we want to do is this:

  1. 1. Use System Update to install the latest version of Mac OS X.

  2. 2. Download the latest iOS SDK.

  3. 3. Install the latest iOS SDK.

  4. 4. Notice that the installer removed the previous iOS SDK.

  5. 5. Don't worry about it; after all, that is what we wanted it to do.

The reason for this cavalier attitude is that the version of iOS on which your game runs has little to do with the iOS SDK that you are using. The version of the iOS on which your game runs is called the Target Platform, and it's perfectly acceptable to have a target platform of iOS 3.0 with the iOS 4.3 SDK.

It took the folks at Unity3D a while to catch on to, and fully support, this idea. Prior to Unity3D, you would need to go into your project settings after each iOS SDK install and update them to reflect the latest version of the SDK (or use Time Machine to restore the removed previous SDK).

Thankfully, those days are gone. Now, setting up our Unity3D project so that it automatically uses the latest SDK, which for the most part is what we want to do, has been greatly simplified.

What we need to do in Unity3D 3.x is this:

  1. 1. Open our Unity3D project.

  2. 2. From the File menu, choose Build Settings.

  3. 3. Under Platform, select iOS.

  4. 4. If required, click the Switch Platform button and wait for our assets to be re-imported.

  5. 5. Click the Player Settings… button.

  6. 6. In the Inspector panel, click Other Settings.

  7. 7. Under Optimization:SDK Version, choose iOS latest (since 4.2), where 4.2 is an iOS SDK version number.

  8. 8. Under Optimization:Target iOS Version, choose the version of iOS, upon which we wish our game to run.

And that is all there is to it. Now, when we install the latest iOS SDK version and re-build our project, the generated XCODE project should be correctly configured and built. It doesn't get any easier and it looks like the following screenshots: