Learn Unity

Unity project examples for the book Learn Unity 4 for iOS Game Development

View the Project on GitHub technicat/LearnUnity

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. The sample code is also available on the Unity Asset Store

The Book

Learn Unity 4 for iOS Game Development is now available!

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.

The book introduces Unity starting with installation and activation, learning the interface with the included Angry Bots demo, and then builds up successively more elaborate project examples from scratch and using free assets from the Unity Asset Store. A simple spinning cube and dancing skeleton scene is constructed, but most of the book is devoted to building a 3D bowling game with the control style of HyperBowl. The game is first developed and tested in the Unity Editor, incorporating graphics, scripting (with JavaScript), physics, sound, user interface, complete rules for a bowling game, and mouse controls. The game is then adapted to run on iOS with touchscreen and (a little bit of) accelerometer input. Testing with the Unity Remote, iOS Simulator and real devices is explained, Game Center and iAd integration is covered, and then optimization techniques are described. The book concludes with a brief treatment of miscellaneous topics such as C# scripting, Unity Editor scripting, Android development, and tracking and promoting sales.

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.


Questions can be posted on the Unity forum, any of my Facebook pages (Technicat, Fugu Games or HyperBowl) and on twitter.

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


Explore Further

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.

Chapter 2 - A Unity Tour

Use the Angry Bots demo to explore the Unity Editor.

Explore Further

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..

Explore Further

Chapter 4 - Making it Move: Scripting the Cube

Create a script (JavaScript), spin the cube, make prefabs, edit and debug scripts with MonoDevelop. Also demonstrate tween animation with iTween from Pixel Placement.

Explore Further

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.

Explore Further

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.

Explore Further

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.

Explore Further

Chapter 8 - Let's Play! Scripting the Game

Implement the bowling game rules with a finite state machine using coroutines.

Explore Further

Chapter 9 - The Game GUI

Implement a scoreboard and pause menu with UnityGUI. Demonstrates Necromancer GUI from Ironbound Studios.

Explore Further

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):

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.

Problems introduced with Xcode 5 (hopefully temporary):

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.

Explore Further


Chapter 13 - Device Input

Implement touchscreen input for the bowling game, detect shakes with the accelerometer, display video textures with the webcam.

Explore Further

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.

Explore Further

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.

In Unity 4.3, the iAd scripting interface has been revised and greatly simplified:


Explore Further

Chapter 16 - Optimization

Optimize for quality, space and speed (just not all at once). Use the Editor and built-in profilers.

Explore Further

Chapter 17 - Where to Go from Here?

Miscellaneous topics: C# and Editor scripts, plugins, customizing script execution order, promoting your apps, more monetization.

Tracking Apps

Back Cover


All Versions


No problems that I can see.



The Code

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.

The App

The HyperBowl-style bowling game developed by following the book, complete with Asset Store assets and Unity Standard Assets, is on the App Store. There is also an Android version on Google Play and the Amazon appstore

5-Star Reviews

Very useful

Great book, very professional and extremely simple

Game programming student's perspective

Wonderful book

This book has great explanation

I read it cover to cover