Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Augmented Reality Game Development

You're reading from   Augmented Reality Game Development Create your own augmented reality games from scratch with Unity 5

Arrow left icon
Product type Paperback
Published in Jan 2017
Publisher Packt
ISBN-13 9781787122888
Length 334 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Micheal Lanham Micheal Lanham
Author Profile Icon Micheal Lanham
Micheal Lanham
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Getting Started 2. Mapping the Player's Location FREE CHAPTER 3. Making the Avatar 4. Spawning the Catch 5. Catching the Prey in AR 6. Storing the Catch 7. Creating the AR World 8. Interacting with an AR World 9. Finishing the Game 10. Troubleshooting

Getting into mobile development with Unity

Now, with all the background set and our course laid out, let's get started by introducing mobile development with Unity. More advanced readers who have developed Unity games on Android or iOS may want to skip ahead to Chapter 2, Mapping the Player's Location.

This installation guide is intended to be cross-platform compatible and should work on Windows, Linux, or Mac. For the sake of brevity, only screenshots for the Windows platform will be shown.

Downloading and installing Unity

Even if you have installed Unity before, but have not done mobile development, make sure that you follow this section closely. There are a couple of important steps you would not want to miss.

Perform the following steps to install Unity:

  1. Open any browser and go to https://unity3d.com/.
  2. Browse through the site and download the Unity installer for the latest stable release. If you have never downloaded Unity before, you will need to create a new account.
  3. Run the Unity installer, click on Next to accept the license agreement and click on Next again.
  4. On the architecture dialog, shown in the following screenshot, make sure that you select 64 bit:

    Downloading and installing Unity

  5. On the select components dialog, make sure that you choose your preferred mobile platform, Android or iOS. Many users will just select all features and install. However, it is better to be selective and install only what you need. Installing all Unity features will require about 14 GB of space, and this can quickly add up if you have installed more than one version.

    In the following example screenshot, we have selected both Android and iOS. Ensure that you only select the platform you need:

    Downloading and installing Unity

    Choose only the components you need

  6. Select the default installation path for Unity and then click on Next to install.

Even with the limited number of components, the installation will still take several minutes, so grab a coffee and wait until it completes.

Setting up for Android development

If you are using an Android device to test the game, use this section to get ready. Developers who already have experience with Android can briefly review this section or jump ahead to the Getting Started with Unity section in this chapter.

Tip

Always install the same architecture version, 64 or 32 bit.

Installing the Android SDK

Follow the subsequent steps to install the Android SDK on your development computer. Even if you already have the SDK installed, please review these steps to ensure that you have the right path and components set:

  1. If you have not already done so, download and install the Java Development Kit (JDK) from http://www.oracle.com/technetwork/java/javase/downloads/index.html.

    Note

    Always note where you install a development kit like the JDK or SDK.

  2. Download the latest version of Android Studio from https://developer.android.com/studio/index.html.
  3. After Android Studio has finished downloading, follow the instructions on https://developer.android.com/studio/index.html to start installation.
  4. As you install Android Studio, make sure that you also install the Android SDK, as follows:

    Installing the Android SDK

    Install the Android SDK component

  5. For the installation location, change the path to something that is easy for you to remember and locate. In the example screenshot, Android/AndroidStudio and Android/AndroidSDK are used:

    Installing the Android SDK

    Select an installation location that will be easy to find later on

  6. After the installation completes, open Android Studio. Open the Android SDK Manager by selecting menu item Tools | Android | AndroidSDK. In the following example screenshot, only Android 5, API Level 21 is selected because it matches the device:

    Installing the Android SDK

    Set the Android SDK location and select API level that matches your device

  7. On the Android SDK panel, set the location path to the same as you used in step 5. Then, select to install Android API level that matches your Android device and click on Apply. Locate the Android version of your phone from Settings | About phone | Android version. This API installation may take several minutes, so this will be a good time for another coffee or the beverage of choice.
  8. After the API installation completes, close Android Studio.

Connecting to your Android device

For best results when following the examples in this book, you will need to connect a physical device to your computer for testing. It is possible to emulate a GPS and camera in an Android emulator, but that is beyond the scope of this book. Follow these steps to get your device connected:

  1. Install the driver for your Android device by following this guide: https://developer.android.com/studio/run/oem-usb.html#InstallingDriver.
  2. Enable USB debugging on your Android device:
    • On Android 4.2 and higher: The Developer options screen is hidden by default. To make it visible, go to Settings | About phone and tap on Build number seven times. After the seventh tap, you will see a message informing you that the developer options are enabled. Return to the previous screen and select Developer options at the bottom to turn on USB debugging.
    • On older versions of Android, go to Settings | Applications | Development to turn on USB debugging.
  3. Connect your device to the computer. On the device you will be prompted to allow USB debugging. Choose Ok and wait for a few seconds to make sure that the driver connects.
  4. Open a command or console window on your computer and navigate to the Android/AndroidSDK folder where we installed the Android SDK to above.
  5. Run the following command-line commands:
    cd platform-tools
    
    adb devices
    
  6. Your device should show up in the list. If for some reason you do not see your device in the list, consult Chapter 10, Troubleshooting. The following console window shows the commands run and sample output:

    Connecting to your Android device

That completes the bulk of setting up an Android device. We still have a couple more settings to make in Unity, but we will cover that in the next section on project setup.

Setting up for iOS development

In order to keep the content of this book focused and the development platform independent, we will not provide a step-by-step guide here. However, there is an excellent guide for iOS setup on the Unity site at https://unity3d.com/learn/tutorials/topics/mobile-touch/building-your-unity-game-ios-device-testing.

After you complete your iOS setup, return to the book, and we will begin building the example game project.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image