Home Game Development Learning Unity iOS Game Development

Learning Unity iOS Game Development

By Kyle Langley , Robert Wiebe US , Nicki Hansen and 2 more
books-svg-icon Book
eBook $39.99 $27.98
Print $48.99
Subscription $15.99 $10 p/m for three months
$10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
eBook $39.99 $27.98
Print $48.99
Subscription $15.99 $10 p/m for three months
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
  1. Free Chapter
    Requirements and Preparation Work
About this book
Publication date:
September 2015
Publisher
Packt
Pages
230
ISBN
9781784399801

 

Chapter 1. Requirements and Preparation Work

Unity 3D is a game engine that specializes in allowing developers to produce games for almost all gaming platforms. For iOS games, we must first prepare the engine so that it can publish builds that Apple will approve of. We will overcome some technical issues, such as how to get the users touch input to control the game from an Apple device, how to unlock achievements that show up in Apple's Game Center, and how to show advertisements in the game.

In this chapter, we will cover the following topics:

  • Downloading and installing Unity 5

  • Using the Unity Asset Store to download and install the iOS SDK plugin

  • Creating and logging in to iTunes Connect

  • Creating the game app in iTunes Connect

  • Setting up Game Center achievements and leaderboards

  • Enabling iAds for the game

 

Requirements


The bare minimum requirements to follow along with this book is a Windows or Macintosh computer that is able to run Unity 5. You also must have a Macintosh computer to compile, test, and submit the game to iTunes and have the most recent operating system for the Macintosh computer to run Xcode. It is important to have the most recent Xcode because the App Store now requires 64-bit compiling for an app to be accepted.

If you have plans on publishing a game to the iTunes Store, you will need an iOS developer account and an iOS license, which costs $99.00 USD per year. For the Unity packages, you will be given an option to use either a free or paid version. I will let you know about the package that I will be using. If you opt to not use the package that I am using, there will be some more work on your end to figure out some technical differences between them, although I will do my best to point you in the right direction.

If you do want to publish a game to the iTunes store, you will need a Macintosh computer with the current Xcode version installed. The most recent version is 6.4 and is available to all OS X Yosemite users. This will be used to create the proper credentials to upload the game to iTunes Connect for review.

Downloading and installing Unity 5

Unity 3D is offered free of charge by Unity Technologies via its website at http://unity3d.com/get-unity.

This page also displays the differences between the professional and free versions.

As of today, the most recent version is 5.0.0. Click on the FREE DOWNLOAD or FROM $75/MONTH button on the web page mentioned before. The current Unity licensing states that if you are a noncommercial entity or make less than $100,000 a year, you are free to use the entire engine without any royalties paid. Due to this reason, I recommend that you use FREE DOWNLOAD. When you click on download, you will get a very small installer. Run this and allow it to download what is needed for the engine. The engine requires 4 GB of HDD space and is about 1.5 GB to download.

Once the download is complete, open the installer. The first window, Download Assistant, will be called. It will ask you what to install. Make sure that you keep Unity 5 checked. You can uncheck Web Player and Standard Assets if you want.

After installing and opening Unity, you will not see any projects. To create one, click on the New Project button in the top-right corner of the Unity window. You can call it anything you desire. At the bottom of the window, there is a selection to change from 3D to 2D. Switch to 2D and click on Create project.

At this point, the editor will open up and give you a blank screen to work with:

Installing the iOS SDK plugin

We can use the free or nonfree version of a plugin. I will use the paid version called IOS Native.

The reason for me not using the free version called iOS SDK Essentials is that its version has not had any care for a while (at the time of writing this book). This means that there could be general update concerns by the time you are reading this.

To get iOS Native for $20.00 or iOS SDK Essentials, open the Unity Asset Store by clicking on Window and then Unity Asset Store or press Ctrl + 9. With the Asset Store window open, use the top-right search field to find either of these packages. From here, you can either buy and/or download it.

Tip

The iOS SDK plugin allows you to trigger events for achievements, leaderboards, and in-app purchases. It also allows you to show iAd banners.

 

Creating and logging in to the iTunes Connect profile


For Apple to approve our game, we must first create the development account for iTunes Connect. If you have no plans of publishing a game to the iTunes Store, you do not have to follow these steps.

  1. Navigate to https://developer.apple.com/.

  2. At the bottom of this page, under Download the latest development tools and SDK, click on the iOS Apps button.

  3. The following page will have a Register for free hyperlink at the top of the page. Click on it.

  4. On the next page, if you have a current Apple ID, click on the Sign In button. If you need to create the Apple ID, click on the Create Apple ID button and follow the steps to create the Apple ID.

  5. When you are logged in to your developer account, navigate to the iOS Dev Center. On the right-hand side, you will find Join the iOS Developer Program. Click on the Learn More hyperlink.

  6. As stated before, you have to pay $99.00 USD per year to join the developer program. Click on the Enroll now button and follow the steps, including the payment information and identity requirements. Again, if you do not wish to publish games to the iTunes store, you do not need to pay $99.00 USD per year.

  7. If you have completed the payment process, go to https://itunesconnect.apple.com.

  8. Log in to iTunes Connect with the account information you created. You will probably see a prompt to enter the required contracts and payment information at the top of this screen. This is required by Apple to sell your game on their store.

  9. You will also see many icons. Click on My Apps.

 

Creating the Bundle ID and Game App


In the top-left corner of the screen, you will see a blue + sign; click on it.

Before you enter any of the information, click on Developer Portal at the bottom of the window. This allows you to set up the Bundle ID before creating the application.

Once at Developer Portal, the App ID Description can be the name of the application. The App ID Prefix should be filled out for you. I will use Team ID. I used Explicit App ID and used the reverse-domain name style: com.mycompanyname.appname. For App Services, I will use Game Center and In-App Purchase:

Click on Continue.

On the next page, Confirm your App ID will display the information that you have entered. If correct, click on Submit. It should follow with the Registration Complete page.

Go back to the My Apps page in iTunes Connect. Again, click on the blue + sign and then New iOS App.

In the popup window that shows, enter the name, version, language, SKU, and bundle ID. If you are curious about what any of these are, you can click on the question mark sign next to the name.

Note

SKU stands for Stock keeping unit. It is a unique tracking number that is used in the app store, which is specific to your application. You can use anything you like as long as it's unique from any of your other apps. For example, you can use com.mycompanyname.appname or your birth date 01012015.

If the name you chose is not taken, you will be taken to the My Apps page for your new game app.

Setting up App pricing and territories

On the App settings page, click on Pricing. You can get here by clicking on My Apps and then opening your game by clicking on its icon.

Pricing is the page where you can choose the initial cost of your application and the territories that will be available.

Availability Date should be the date, in which you will create this application. You can leave it as default for now. In the future, if you want to change the price for something, such as a sale, Availability Date will dictate how long this pricing tier can last.

For my game, it will be free. To set this or any other price, click on the Price Tier drop-down list and select the price.

To use Discount for Educational Institutions, use your own discretion:

The last thing you need to do on this page is click on specific territories at the bottom of the settings page. Everything is defaulted to be selected. If there are any territories you don't wish to have your game available on, click on the checkbox next to it. When done, click on Save at the bottom of the page.

The page should load back to Rights and Pricing and have the Completed box at the top of the page.

Creating an in-app purchase

First, click on the My Apps drop-down list at the top of the page and select My Apps. Then, click on your game to go back to the settings page.

Next, click on In-App Purchases.

The page will read No In-App Purchases have been set up for this app. To set one up, click on Create New.

Then, click on Non-Consumable.

There are five purchase types:

  • Consumable

  • Non-Consumable

  • Auto-Renewable Subscriptions

  • Free Subscription

  • Non-Renewing Subscription

Reference Name is the name that will be displayed in iTunes Connect and in Sales Trend reports. It is not displayed on the App Store. It's a way for us to have a reference to what it is we will sell when we look at reports.

Name it Remove_Ads with an underscore.

The product ID is a unique ID that is used to report the purchase. Typically, I would name this as gamename.referencename. Generally, this would be written as <<gamename>>.<<referencename>>, which symbolizes that you can put anything between these fields; however, as not all of you are aware that these symbols represent a dynamic field—meaning that it is about the formatting and not the literal text—gamename.referencename is the literal view of how it's inputted.

As I don't know the name of your games and we will both have to use this in the future chapters, the naming will have to match.

Name the product ID as G_RemoveAds with an underscore.

Under Pricing and Availability, select Yes for Cleared for Sale. For Price Tier, I have selected Tier 1, which is $0.99USD. If you are curious about the pricing matrix, click on View Pricing Matrix.

At the bottom of the page, click on Add Language.

A pop-up window will appear. Select English as the language if not already selected. Display Name is the name of the in-app purchase that will be seen by customers.

Enter Remove Ads.

Description is the description of the in-app purchase that will be used by App Review during the review process. It is used to describe what the purchase will do.

Enter Stops displaying iAds in the game.

Then, click on Save.

For Hosting Content With Apple, select No.

There is no need to have Review Notes.

We will add a screenshot of the purchase in the game when it is done in a later chapter. As a note, without screenshots, Apple will not be able to put the game on the App Store.

Now, click on Save.

The page should load to show the purchase we just made and have the status of Waiting for screenshot. We will add a screenshot in a later chapter.

Click on Done. This should load you back to the App page. If not, click on My Apps and then select My Apps. Now, select your game.

Game Center, leaderboards, and achievements

When you are back at your game settings page, click on Game Center. The Enabled bar should already be set. If you see Disabled, click on it. The bar should turn to Enabled, and the color should turn to blue.

The next tab has two options: Single Game and Group of Games. Select Enable For Single Game.

Under Leaderboards, click on Add Leaderboard.

On the next page, under Single Leaderboard, click on Choose.

The next page will load with similar settings as the in-app purchase. For Leaderboard Reference Name, enter Distance.

For Leaderboard ID, enter G_Distance.

The Type of Score Format is Integer. This allows you to have a value that keeps track of the distance the player has moved. By whole distance, I mean a nondecimal-based value, such as 1, 2, 3, 4, and so on.

The Type of Score Submission should be set to Best Score. Leave this as it is. This way, we can save the distance with the player, save the profile locally, and only submit the score when its distance is greater than what they had done previously.

Sort Order is the order in which the leaderboards will appear. As the distance we are looking for is the highest value, change this to High to Low. This way, the player with the farthest distance will be at the top of the list.

As we have not programmed the value to calculate the distance, go ahead and leave Score Range blank. This will give us plenty of room to work with.

At the bottom of the window, click on Add Language.

Set Language to English and Name to Distance.

Score Format is a way to set a difference in the formatting of the score. For example, if our score was based on money, we would want to use a comma to separate the numbers. However, as we will use this value as a distance, we need to separate the values with a decimal point. Select Fixed Point (10.000.012,218 ).

The Score Format suffix is what will be added to the end of the score. Like before, if we were using money, we could end the formatting with "Dollars "or "Coins". As we will use this as a distance traveled, enter Yards.

Leave the Image field blank.

Then, click on Save.

The page should load back to the Add Leaderboard page with the information you have set.

Now, click on Save.

Tip

For the purposes of this book, one leaderboard is enough. Feel free to add more though! You could include things, such as "Deaths", "Pickups Collected", or "Attempts".

The page should load back to the Game Center page. If not, go back to My Apps, select your app and then Game Center.

For the achievements, we will set three of them. One for surviving "100 yards", one for "collecting 100 pickups", and one for "Play 10 Rounds". At the bottom of the page, click on Add Achievement.

For Reference Name of Achievement, enter 100Yards.

For ID of Achievement, enter G_100Yards.

Again, usually games would refer to these IDs with a format such as <<gamename>>.G_100Yards or literally gamename.G_100Yards, but because these names have to match the code that we are writing together and the game name is going to vary, you can use the direct achievement name: G_100Yards.

Point Value is the number of achievement points the Game Center account will be credited with when the achievement is collected. The value is completely arbitrary; you can enter anything you want. I will use 10.

Tip

Make sure to leave room for the next two achievements because if you use all 1000 points with this one, you won't be able to make any more achievements.

Select No for Hidden. If you use Yes, the achievement won't be in the list of achievements for our game until they have earned it if the user was to look at Game Center. As I would like the players to see their achievements, they can earn before earning them; selecting No will allow them to do this.

For Achievable More Than Once, select No. This is a one time achievement.

At the bottom of the page, click on Add Language.

The Title is 100 Yards.

The Pre-earned Description tab is what will appear in Game Center if the user is to look it up. You can enter what you like to describe this achievement. I will use Survive for 100 yards.

The Earned Description tab is what will display on Game Center after the user collects the achievement. Again, this is open. I will use You survived 100 yards!.

A package of art is included with this book. In the iTunes_Connect_Achievements folder, use the image called 100Yards.png for Choose File.

Tip

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. 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.

The three files look similar to the following image:

Click on Save.

Back on the Add Achievement page, it should list the information for the 100 Yards achievement. Then, click on Save.

Follow the same method for the next two achievements with the following settings:

  • [100 Pickups]:

    • Reference Name: 100Pickups

    • Achievement ID: G_100Pickups

    • Points: 10

    • Hidden: No

    • Achievable More Than Once: No

    The following is the Language setting for [100 Pickups]:

    Language: English

    Title: 100 Pickups

    Pre-earned Description: Collect 100 Pickups

    Earned Description: You have collected 100 Pickups!

    Image: 100_Pickups.png

  • [Play 10 Rounds]:

    • Reference Name: 10Rounds

    • Achievement ID: G_10Rounds

    • Points: 10

    • Hidden: No

    • Achievable More Than Once: No

    The following is the Language setting for [Play 10 Rounds]:

    Language: English

    Title: 10 Rounds

    Pre-earned Description: Play 10 rounds

    Earned Description: You have played 10 rounds!

    Image: 10_Rounds.png

Go back to the main page for your app and scroll down to where you see Game Center. The button should be grayed out. Click on it and it should turn green.

Click on the + sign next to Leaderboards. In the window that pops up, select the single leaderboard that we set up and then click on Done.

Now, click on the + sign next to Achievements. Select all the achievements we set up and then click on Done.

At the top of the screen, there is a Save button. Click on it to save the settings.

Tip

Once your game goes live, the achievement IDs and the point values for them is impossible to change. Make sure that during testing, you decide on these options as soon as the game is on the store; you will never be able to alter them.

 

The Main App settings


After you are done with the achievements, go back to the game app main page. This page is used to show all the public information for the game; the information users will see when the game appears on the store:

  • App video Preview and Screenshots: This is the area where you can place screenshots and a video preview of the game. Apple requires different image sizes for all their devices. If you want your app to show images, you will need to create, scale, and upload all the images here. The video preview also has to be in a Mac-friendly codec, such as M4V. The screenshots for the app are required, and your game will not be able to go live until you have them included in these slots; the video is up to you and not required by Apple to submit your game.

    Tip

    If you want to convert a AVI file to a M4V file, you can use a program called HandBrake (https://handbrake.fr/).

  • Description: This specifies the description of your app. This area is open for you to describe the game and why the user may be interested in it.

  • Keywords: This denotes the list of keywords that describe your app. When the user searches, these keywords are used to match your app to that search.

  • Support URL: This specifies the URL that a user can go to get help with the app. This is generally the studio website or the creator's personal e-mail.

  • Marketing URL: This is the URL that would be used as marketing for your app. This is optional.

  • Privacy Policy URL: This would link the user to the privacy policy of your game. This is required for apps that are made for kids, if you offer autorenew in-app purchases, or if you have free subscriptions. If you include account registration, an app that would access the users existing account, or if (by chance) your app is required by law, this is also required.

  • App Icon: This is the icon of your app. It is what the user will see when it appears on the store.

  • Apple ID: This specifies the ID of this app.

  • Version: This is the current version of the app.

  • Category: This specifies the category that the app falls into. For us, it is "Games".

  • Rating: This denotes the rating of this app.

  • License Agreement: This specifies the standard license agreement between you and Apple.

  • Copyright: This denotes the name of the person or entity that owns the rights to this app. In the example of this book, you would probably just use your name.

  • Trade Representative Contract Information: This allows you to display additional information that would be displayed on the Korean App Store.

  • Name, Address, and Country: This specifies your personal information about who owns the app.

  • Routing App Coverage File: This allows you to specify the geographic regions supported by your app.

  • Build: This is the current build and is uploaded with Xcode 5.1.1 version or later or the Application Loader 3.0 version.

  • Game Center: This denotes the achievements and leaderboards used for this game. You set these earlier.

  • Multiplayer Capability: This specifies the games that are multiplayer-capable. Keep this as it is.

  • Newsstand: Keep this unused.

  • App Review Information: This specifies the information that the Apple review team will use to contact you if they need any information during the review process. You'd generally use the name of the person in charge of quality assurance. In my case, I will use my name and e-mail.

  • Demo Account: This is used if the game needs an extra account to play, such as if you had a multiplayer service that required a log in, you would give the reviewers a demo account so that they could test the game with the extra service. For us, we can leave this blank.

  • Notes: This specifies the additional information that the review team may need to test the app. As our game will be on the simple side, you can leave this blank as well.

  • Version Release: This is the setting you can use to either automatically release the game as soon as it clears review or to set it up, so Apple lets you know when the game has cleared review. This is a personal choice. I generally use Manually release this version to make sure that everything is correct before it goes to the store.

At the very top of the page, click on Save.

Enabling iAds

At the top of the page, click on My Apps, and in the window that pops up, click on Agreements, Tax, and Banking.

On this page, you will have to fill out and accept the contracts for iOS Free Application, iOS Paid Applications, and iAd App Network. The process includes the personal banking information and the identity verification. When you have completed these, the game will be set up to sell and display iAds.

Setting up iOS Native in Unity

As Unity does not support the native functionality of iOS, we need a plugin to call the native iOS functions from Unity. For example, if we want to provide the user with the in-app purchase, we need this plugin to handle the code that takes care of this.

For our plugin to know about the specifics of our game, we must first include the Apple ID and the Bundle ID.

In Unity, click on Window at the top of the editor screen, navigate to iOS Native, and select Edit Settings.

The Inspector window should update to show iOS Native Settings.

In iTunes Connect, navigate to My Apps and click on your game. This will open the main settings page. About halfway down, you will find the text for Apple ID. This is a big integer value. Copy this and go back to Unity; you can select the text and click on Ctrl + C, or you can write it down.

In iOS Native Settings in Unity, under Apple ID, paste or enter the Apple ID from iTunes Connect:

While still in Unity, click on File in the top-left corner of the editor window. Then, navigate to Build Settings.

If your project is set to PC, Mac & Linux Standalone, click on IOS. In the bottom-left corner of the window, click on Switch Platform.

Next, in the same window, click on Player Settings. This will update the Inspector window. Under Other Settings, find the section under Identification and then the textbox labeled PlayerSettings.bundleIdentifier. In this field, enter the Bundle ID that you set up earlier. I used the reverse-domain name style, such as com.mycompanyname.appname.

If you do not remember your Bundle ID, navigate to iTunes Connect, select My Apps and then select your game. On the right-hand side of the window, click on More and then About this app. In this window, you will see the game information, including the Bundle ID of the game.

You can leave PlayerSettings.bundleVersion set to 1.0.

Tip

iOS Native is recommended even with the extra cost. If you do opt not to use it and try a free version, you will have to find some of these settings for this plugin.

Certificates and provisions on Mac

Apple has come a long way when it comes to making the provisions and certificates for games. This used to be a headache, but now, we can use Xcode to generate these for us.

The first step is that you will need to make a build and open it in Xcode. This can be done from your Windows or Macintosh machine, but it has to be opened on your Mac.

To create the build, open Unity and navigate to File in the top-left corner of the editor window. Then, go to Build Settings.

Make sure that the build is iOS and Development Build is checked.

As there is no reason to run this build on a device, you do not have to have a scene selected in the Scenes in build window.

Open Player Settings and make sure that PlayerSettings.bundleVersion is 1.0, and PlayerSettings.bundleIdentifier is set to the Bundle ID of your app.

Under Optimization, there are a few settings that you can keep as default so that you know what the important ones do:

  • API Compatibility Level: This allows you to set the .NET API profile. The .NET 2.0 API is the full .NET compatibility, whereas the .NET 2.0 subset is the subset of the full .NET compatibility and has smaller file sizes.

  • Target iOS Version: This selects the iOS version you want to target your game to. The lower the version number you use, the more devices can run your game. Using a higher version means that you have the option to utilize the features of this higher version, but users who have not upgraded their device to run this version will not be able to run your game.

  • Stripping Level: This option allows you to have the engine remove the unused aspects of the code to optimize the file size of your game.

    • Strip assemblies level: This will look at the scripts by the code and remove any classes and methods that are not being used.

    • Strip ByteCode level: This takes any of the .NET DLL files and strips them down to metadata only.

    • Use micro mscorlib level: This is a special option to use a small version of mscorlib. This does remove some features, including security, Reflection.Emit, remoting, and nonGregorian calendars.

When everything is set, click on Build. This will prompt you to save the build at a location on your computer. It doesn't matter where.

When the build is done, navigate to where you saved it. If you are not on a Mac, you need to copy this whole folder onto your Macintosh machine. You can do this with version control, a local network, or you can zip it up and send it to yourself and then download it on your Mac.

In order to open the project in Xcode, open the folder and double-click on the file that ends with Xcodeproj. This will open Xcode and your project.

In the General tab in Xcode, you will see the project general settings. This includes things, such as Bundle Identifier, Version, Deployment Target, and the type of devices the game will run on.

Under the Identity portion of the General settings tab, there is a drop-down menu for Team. Click on it and then select Add an account. This will open the Accounts window. In the bottom-left corner of this window, click on the small + sign and select Add Apple ID…. This will prompt you to log in with your developer credentials. Use these credentials to log in.

After logging in, you can close the Accounts window. Now, from the Team drop-down list, you should be able to change it from None to your team name, which is probably the name and e-mail you used to create your account:

To make sure the certificate went through, visit https://developer.apple.com.

At the bottom of the page, click on iOS Apps.

On the following page, if not logged in to your developer account, log in. After this, in the top-right corner, click on the link called Certificates, Identifiers & Profiles.

Under iOS Apps, click on Certificates.

When the page loads, you should have All selected in the Certificates section. On the right-hand side of your screen, you should see your name, the type of certificate, and the expiry date (1 year after the creation of it):

Through the course of this book, we will use two different types of certificates: iOS Development and iOS Distribution.

iOS Development refers to a certificate you can use during development, and iOS Distribution is the certificate that can be used when you are ready to submit your game for distribution.

Why iTunes Connect is important

The process of setting up iTunes Connect and Developer Account is important because these are the settings we will use in Unity in order to unlock achievements, leaderboards, in-app purchases, and display iAds.

If we didn't go through the process of creating an app in iTunes Connect, it would be impossible to release a game on the App Store, and if we didn't set up the Game Center features, we wouldn't be able to have achievements or leaderboards. The same is true for in-app purchases and iAds.

 

Summary


In this chapter, we looked at basics of how to set up Unity and the iTunes network in order to create the iOS game. Apple has come a long way since the inception of iOS development, but the process can still be quite tedious.

In the next chapter, we will go through the game and begin to develop the input controller, which will be used to manipulate our game by the end user.

About the Authors
  • Kyle Langley

    Kyle Langley is a self-taught game designer who has worked on games such as Transformers: Fall of Cybertron released by High Moon Studios and Warm Gun, Carnival of Bullets, and Maximum Overdrive released by Emotional Robots. He is currently developing a multiplayer PC title for Vex Studios called Jeklynn Heights. Kyle has also tutored many game design students and has previously released a beginners' programming book for Unreal Development Kit called Learn Programming With Unreal Script. His website is, www.dotvawxgames.com.

    Browse publications by this author
  • Robert Wiebe US

    Robert Wiebe has more than 30 years experience designing, implementing, and testing software. He wrote his first game in 1979 as a high school student. He has focused on developing games and utilities for Android, iOS, and OS X. He has written the following apps: Video Kiosk, ShredIt, NetShred, Coconut Hut, and many more. His interests include Unity 2D/3D game engine, developing video series, writing books, and researching virtual reality games. He has experience in developing software for a number of industries, including mining, finance, and communications. After working for other peoples companies, he founded his own companies, Mireth Technology, and BurningThumb Studios, which are his primary interests today.

    Browse publications by this author
  • Nicki Hansen
  • Ravi Gadesha
  • Tejas Jasani
Latest Reviews (3 reviews total)
Learning Unity iOS Game Development
Unlock this book and the full library FREE for 7 days
Start now