Book Image

Unity 2020 Mobile Game Development - Second Edition

By : John P. Doran
Book Image

Unity 2020 Mobile Game Development - Second Edition

By: John P. Doran

Overview of this book

Unity 2020 brings a lot of new features that can be harnessed for building powerful games for popular mobile platforms. This updated second edition delves into Unity development, covering the new features of Unity, modern development practices, and augmented reality (AR) for creating an immersive mobile experience. The book takes a step-by-step approach to building an endless runner game using Unity to help you learn the concepts of mobile game development. This new edition also covers AR features and explains how to implement them using ARCore and ARKit with Unity. The book explores the new mobile notification package and helps you add notifications for your games. You’ll learn how to add touch gestures and design UI elements that can be used in both landscape and portrait modes at different resolutions. The book then covers the best ways to monetize your games using Unity Ads and in-app purchases before you learn how to integrate your game with various social networks. Next, using Unity’s analytics tools, you’ll enhance your game by gaining insights into how players like and use your game. Finally, you’ll take your games into the real world by implementing AR capabilities and publishing them on both Android and iOS app stores. By the end of this book, you will have learned Unity tools and techniques and be able to use them to build robust cross-platform mobile games.
Table of Contents (14 chapters)

Unity for iOS setup and Xcode installation

With Android, there's a lot of setup, but building and getting a game onto your device is less work, whereas, with iOS, there's less work on the setup end and more involvement with getting the game actually onto the device.

Previously, you had to have a paid Apple Developer license in order to get your game onto an iOS device. Although that's still required to get the game on the App Store, you are no longer required to get it for testing. Note that the free option doesn't have everything available to you, most notably In-App Purchases (IAPs) and the Game Center; however, for making sure that it works on your device, it'll work just nicely. We will go over how to adjust your project to reflect being in the Apple Developer portal in Chapter 11, Game Build and Submission, when we go over putting our project on the App Store.

To develop for an iOS device, in addition to the device itself, you'll also need to go on a Mac computer that runs OS X High Sierra 10.13+ or a later version. I'll be using 10.15.6 macOS Catalina. Just like working with Android, we'll also need to do some setup before we can actually do the exporting. Let's get started on that now:

  1. First of all, if you haven't done so already, you'll need to add iOS Build Support (*) as an option when you are installing Unity. If you did not install it when doing the initial installation, you may open up the Unity Hub and select the Installs section.
  2. From there, click on the three dots to the right of your current version of Unity and select the Add Modules option:
  1. From the menu that pops up, check the iOS Build Support option:
  1. Click on the DONE button and wait for the installation to finish. Once completed, you should see the icon for iOS support show up:

This makes it so you can export your projects for iOS. Since I'll be using my Windows machine mainly, I'm only adding in iOS support, but you can do both iOS and Android from your Mac computer.

  1. You'll also need to have Xcode, which is the program used to build iOS apps. To download it, you'll need to open up the App Store application on your computer. From the search bar in the top-left corner, type in Xcode and press Enter.
  2. From there, you'll see the Xcode program at the top left of the page. Click on it and then on the Install/Update button:

You may need to enter your Apple ID information; go ahead and do so and then wait for it to finish.

If you do not have an Apple ID, you may get one from http://appleid.apple.com/.
  1. Once Xcode is installed, open it up. There will be a license agreement for Xcode and the iOS SDK; go ahead and click on Agree. It'll then begin installing components that are needed for it to work.
  1. You'll then be brought to a welcome screen, but we want to do some setup first. From the top menu bar, go ahead and select Xcode | Preferences (or press command + ,). From there, click on the Accounts button. This will display all of the Apple IDs that you want to be able to use in Xcode:
  1. Click on the plus icon at the bottom left of the screen and then select Apple ID when it asks what kind of account to create:
  1. From the menu that pops up, go ahead and add in your Apple ID information and you should see it appear on the screen.

If you select the name, you'll see additional information on the right side, such as what teams you are on. If you are not enrolled in the Apple Developer Program, it'll just be a personal team, but if you are paying for it, you should see additional teams there as well.

Now that we have completed the setup and installation of iOS and Xcode, let's continue to building our project.