This is the GitHub page for the book Learn Unity 4 for iOS Game Development, the Unity projects for each chapter, and the accompanying Learn Unity bowling game app.
Learn Unity 4 for iOS Game Development is now available!
- Amazon (print and kindle book)
- Apress (print, pdf, epub and mobi) Alpha purchasers should download the latest, final
- Barnes and Noble (print and nook book and in stores)
- Goodreads (links to online bookstores)
- Google Books (links to online bookstores)
- iBookstore (iBook)
- Indigo (Canada) and Kobo
- Langton Info (UK)
- Safari Books (online subscription)
- Springer Link
- WH Smith
The ebook versions provide samples of the first chapter, Safari Books provides shows a portion of each chapter, and Chapter 10 (Using Unity iOS) is viewable free on my technicat site.
Some retail descriptions list Unity's Mecanim animation system. The book does mention but does not use Mecanim. Instead, a chapter is devoted to a dancing skeleton example using Unity's Legacy animation system and a free skeleton package on the Asset Store. Also, some retail descriptions list Unity's support for gyroscope on iOS devices. The book does mention but does not use Unity's gyroscope API (Input.gyroscope). The book does describe how to access the touchscreen (Input.touches), accelerometer (Input.accelerometer), and webcam (WebCamTexture).
Technical review was provided by Marc Shårer of Gayasoft.
A newer edition of this book is available, updated by Allan Fowler.
Contents, Clarifications, and Corrections
Page numbers correspond to the print version. Links are provided to the online Unity documentation cited in the Explore Further sections.
About the Author
- page xxi: Snow Crash should be italicized. And that's by Neal Stephenson, by the way (The Diamond Age is also highly recommended).
- Beginning 3D Game Development with Unity
- [Unity 3.x Game Development Essentials] (http://www.packtpub.com/unity-3-x-game-development-essentials)
- [Game Development for iOS with Unity3D] (http://www.crcpress.com/product/isbn/9781439892190)
A full list of Unity books is available at Games from Scratch
Chapter 1 - Getting Started
Download and install Unity, activate the license, report bugs, get help.
- page 3: "OSX installer package" should read "OS X installer package"
- page 5: "Script Reference" should read "Scripting Reference"
- page 5: "Scripts.unityPackage" is one word
- page 7: Starting with Unity 4.2, he free version of Unity now includes Unity iOS Basic (and Unity Android Basic)
- page 13: "The 3D game engines are very complicated" should read "3D game engines are very complicated"
Chapter 2 - A Unity Tour
Use the Angry Bots demo to explore the Unity Editor.
page 25: "go ahead and buildl an OS X app" should read "go ahead and build an OS X app"
page 58: "Console" and "Console view" should read "Console View" (for consistency, we include "View" in the view name and capitalize as in the Unity documentation - think "Eiffel Tower" vs. "Eiffel tower")
page 58: "a script calls a Log.LogError" should read "a script calls Debug.LogError"
page 58: Starting with Unity 4.1, filtering of Console View messages is controlled by the three buttons at the top right of the view. Tip: make sure that error messages are not filtered.
page 60: Starting with Unity 4.2, YAML support (the Force Text option in Editor Settings) is availble in Unity Basic
page 60: Starting with Unity 4.2, the Editor has integrated Perforce support and an API for supporting other version control systems.
Chapter 3 - Making a Scene
Create a new Unity scene, add primitive models, textures, lighting, and camera movement. Import assets from Standard Assets, the Unity Asset Store, and the file system. This chapter uses the Free ArtskillZ Texture Pack 01 from ArtskillZ..
- page 63: "Assets that were installed with Unity in the previous chapter" should read "Assets that were installed with Unity in Chapter 1
- page 67: "Script Reference" should read "Scripting Reference"
- page 109: "Building a Scene" should read "Building Scenes"
Chapter 4 - Making it Move: Scripting the Cube
Chapter 5 - Let's Dance! Animation and Sound
Import a dancing skeleton and music, select and loop the animation and music, add shadows and particle effects. This chapter uses the Skeletons Pack from bisaniyehocam and General Music Set from Gianmarco Leone.
- page 164 - Starting with Unity 4.2, dynamic shadows are available in the free version of Unity, but only hard shadows with directional lights, so if you're running Unity free, select Directional for the type of the light and Hard Shadows for the shadow type.
Chapter 6 - Let's Roll! Physics and Controls
Create the beginnings of a bowling game. Make a ball and floor, add colliders and rigidbodies for collision detection and collision reaction, respectively. Uses Eighteen Free Substances from Allegorithmic.
- page 211 - AddTorque, AddRelativeTorque, AddExplosionForce, AddForceAtPosition should be formatted like the other function names/pages (i.e., in quotes).
- Scripting Reference
Chapter 7 - Let's Bowl! Advanced Physics
Add bowling pins using primitive models and models from the Asset Store. Construct compound colliders. Add sound effects triggered by collision callbacks. Uses the Free SFX Package from Bleep Blop Audio and Barrel from Universal Image.
Chapter 8 - Let's Play! Scripting the Game
Implement the bowling game rules with a finite state machine using coroutines.
- page 281: The link to the Blue Mars wiki, "http://create.bluemars.com", should read "http://create.bluemars.com/wiki"
Chapter 9 - The Game GUI
- Scripting Reference
- Asset Store
Another one I forgot to mention:
Chapter 10 - Using Unity iOS
Return to Angry Bots to get familiar with Unity iOS. Switch the build target to iOS, customize Player Settings, test in the Editor with Unity Remote, build to Xcode and test in the iOS Simulator.
Problems introduced with Xcode 5 (hopefully temporary):
- Build and Run in the Unity Editor fails to start Xcode 5. Workaround: start Xcode manually first, or double-click the xcodeproj file to bring up Xcode 5 manually, then click the Run/Play button.
Chapter 11 - Building For Real: Hardware Testing and App Submission
Set up devices, provisioning profiles and app descriptions on the Provisioning Portal and iTunes Connect. Build Angry Bots for test devices and for submission to the App Store.
Xcode no longer displays provisioning profiiles, and it is no longer necessary (or possible) to install development provisioning profiles on test devices via the Xcode Organizer. The profile is autmatically installed if necessary when running/installing the app.
Problems introduced with Xcode 5 (hopefully temporary):
- In Xcode 5, Archive may complain there is no matching provisioning profile for the test device. Workaround: detach the test device before invoking Archive.
Chapter 12 - Presentation: Icons and Splash Screens
Resume work on the bowling game. Automatically scale the GUI for different screen sizes. Incorporate initial and secondary splash screens.
It should be noted the Fugu Games splash screen and the Fugu icon (also used as a texture in Chapter 3) are based on the Fugu Games logo designed by Shane Nakamura.
- page 390: The x and y values specifying the normalized screen coordinates of the GUITexture are entered in the Transform Component's position.
Chapter 13 - Device Input
Implement touchscreen input for the bowling game, detect shakes with the accelerometer, display video textures with the webcam.
- (page 407) Starting with Unity 4.5, the Camera far property has been renamed farClipPlane.
- Scripting Reference
- iOS Developer Library
- Event Handling Guide
- Camera Progrmaming Topics for iOS
- AV Foundation Programming Guide
- Asset Store
- Finger Gestures
- Prime31 plugins
Chapter 14 - Game Center: Leaderboards and Achievements
Set up Game Center leaderboards and achievements in iTunes Connect. Submit high scores and achievements and activate iOS5-style achievement banners with scripts.
Chapter 15 - iAd: Banner and Interstitial Ads
Set up iAd in iTunes Connect. Add a banner ad and intersitiai ad to the bowling game with scripts.
- page 443: In "The while loop calls yield", "yield" should be formatted as inline code
- page 443: "the ad will immediately display by with a call to" should read "the ad will immediately display with a call to"
- page 443: "which will show up as check boxes" should read "which will show up as checkboxes"
- page 447: "the static variable of iPhone.generation" should read "the static variable iPhone.generation"
Apple has since discontinued iAd, so there is no longer a scripting interface. There are other ad services with Unity script interfaces, including Unity's own Unity Ads.
Chapter 16 - Optimization
Optimize for quality, space and speed (just not all at once). Use the Editor and built-in profilers.
- page 474: "Inspector view" should read "Inspector View"
- page 496: "Player Settings" should not be quoted (not a reference to a Unity Manual page)
- page 496 "Automatic Memory Management" should read "Understanding Automatic Memory Management"
Chapter 17 - Where to Go from Here?
Miscellaneous topics: C# and Editor scripts, plugins, customizing script execution order, promoting your apps, more monetization.
- page 512: "Storekit" should read "StoreKit" as in the Prime31 documentation (or "Store Kit" as in the Apple documentation)
- page 513: "not available on Android either" should just read "not available on Android"
- page 513: There should be a paragraph break after "Twitter, by the way, is another great way to interact with other Unity developers, on a more personal level."
- page 513: Of course, the UNITY_IPHONE preprocessor definition is not active when the build target is Android. Use UNITY_ANDROID instead (or in addition). Unlike iOS, Android apps conventionally have a Quit button and Android devices have a Back button that is recognized by Unity as the Escape key. The GitHub project for this chapter includes those Android-specific changes in the pause menu. Backing up the assertion that the code in this book works on Android, the Learn Unity app is available on Google Play and the Amazon Appstore, and for the Nook and the Nabi tablets.
- "Three-dimensional games" should read "3D games" (no one says "three-dimensional glasses" or "three-dimensional movies")
- Many of the quoted titles in the Explore Further sections should be links to online documentation (for the Scripting Reference pages, try searching for those terms in the Scripting Reference search box).
No problems that I can see.
- Figure links don't always work.
- There is a second Kindle edition with a publication date of August 4. I don't know what's different about it except it's been reported that the full table of contents (not the Contents at a Glance) has broken links.
- URL's display with markup and are not active as links (you can check the sample to see if it's been fixed.
The GitHub projects, built up cumulatively through each chapter to create a bowling game similar in style to HyperBowl, do not include assets from the Unity Asset Store and Standard Assets that are used in the book, but you can use them a starting point or to save time in constructing the book examples (but taking shortcuts isn't really recommended). The projects require Unity 4.2 or later and are covered under the MIT open source license.