Book Image

Learning Unity iOS Game Development

Book Image

Learning Unity iOS Game Development

Overview of this book

Table of Contents (14 chapters)
Learning Unity iOS Game Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
6
Main Menu, iAds, Leaderboards, Store Purchases, and Achievements
Index

Preface

Learning Unity iOS Game Development covers everything that is needed to create and publish an iOS game using Unity 5. The process includes creating an Apple Developer account, creating a new App using iTunes Connect, which includes the Game Center integration of leaderboards and achievements, and creating an in-app purchase and displaying iAds to the user. Furthermore, we will go through many of the introductory steps within Unity 5 to create a fully functional game with the C# programming language. We will also discuss its application in creating a user interface that takes touch input, stores saved data, and has a full game loop so that the player can navigate between the menu and game states. Finally, we will go through the process of creating a test build before finally making a distribution build to submit to Apple for approval.

What this book covers

Chapter 1, Requirements and Preparation Work, teaches you how to create an iTunes Developer account and the app with the settings for leaderboards, achievements, in-app purchases, and iAds. It also teaches you how to download and install Unity 5 in order to create a new 2D game project.

Chapter 2, Player Input for Mobile Devices, writes the C# code needed to both test inside of Unity 5 and take user input on the iOS device.

Chapter 3, Player Character, Obstacles, and Pickups, uses Unity 5 to create GameObjects that visually show a 2D sprite and animation before writing the C# code so that they are interactive in the scene.

Chapter 4, Editor Tool, Prefabs, and Game Level, uses the Unity 5 EditorWindow class and C# to write an editor tool that will help create the GameObjects that make up the game level before discussing how to create and use prefabs to put together the game level.

Chapter 5, Scene Background, the Game User Interface, and the Save Profile, writes a C# class that manages background sprite images before discussing the basics of the Unity 5 UI system and how to use the PlayerPrefs class to save game data.

Chapter 6, Main Menu, iAds, Leaderboards, Store Purchases, and Achievements, shows further development using the Unity 5 UI system to create the main menu and how to set up the main menu to show leaderboards and achievements, handle in-app purchasing, and display iAds to the device screen.

Chapter 7, Game Builds and Submission To Apple, creates a test build to play on your device before going through the process of creating a distribution build that you can then submit to Apple for review.

What you need for this book

In order to compile and submit an iOS build, you must have a Macintosh computer running the most current OS X version and have the most recent version of Xcode installed. You will also need a computer that meets the minimum requirements to run Unity 5, which includes Windows XP SP2+, Windows 7 SP1+, Windows 8+, or Mac OS X 10.8+, and a graphics card that supports DirectX 9.

You will also need a plugin that allows you to access native iOS functions that can handle in-app purchases. In the book, I use IOS Native, which is available through Unity Asset Store.

To only follow the process and not build or submit the game to Apple, you simply need any computer that has the minimum requirements to run Unity 5.

Who this book is for

This book is for those who are either brand new to game development or those who have made games for other platforms and are looking to explore how to make games for iOS. You need to have basic computer knowledge, including how to install, open, and navigate programs through instruction, as well as the desire to follow along and write computer code.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "This means that if the game is running at 30 frames-per-second, Update() will be called 30 times in that second."

A block of code is set as follows:

using UnityEngine;
using System.Collections;
public class PlayerInput : MonoBehaviour
{
  /* Use this for initialization */
  void Start ()
  {
  }
  /* Update is called once per frame */
  void Update () 
  {
  }
}

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "When this folder is created, right-click on it. Then, navigate to Create and select C# Class."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from: https://www.packtpub.com/sites/default/files/downloads/9801OT_Graphics.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.