Sunday, February 2, 2014

Connecting Android Devices to Unity for Game Development

Developing Android games in Unity is incredibly simple and well done in Unity, however getting your phone to sync to Unity is not all that easy. It took me days to figure out how to get them connected properly. Here is every single step that you need to take to get your environment set up to develop Android Unity Games and notes to help you deal with any of the problems that you might have along the way.

It seemed like everything that could have gone wrong went wrong when I was trying to get this installed, so I hope that this helps you to get it done faster than I did.

Step 1: Download the Android SDK

  1. Press the big blue button
  2. Unzip the folder
  3. Rename the unzipped folder ‘Android
  4. Move the folder to C:\
  5. Open the folder and click on ‘SDK Manager.exe
  6. Check:
    1. Tools
      1. Android SDK Tools*
      2. Android SDK Platform-tools*
    2. Android 4.4.2 (API 19), or whatever the latest build is
    3. Extras
      1. Android Support Library*
      2. Google USB Driver*
      3. Google Web Driver*
  7. Click ‘Install x Packages

* These are the only things that you need to install, but you can just install the full Tools and Extra directory for simplicity.

Step 2: Prep Your Phone

  1. Download ‘Unity Remote’ in the Google Play Store.
  2. Go to Developer Options and check off:*
    1. Stay Awake**
    2. USB Debugging **
    3. Allow Mock Locations**
  3. Plug your phone into your computer.
  4. Wait for it to open as a USB device.``
  5. Launch ‘Unity Remote

* In Android Jellybean and higher the developer options are hidden.  You can make them available by going to Settings > About Phone and tapping Build Number until the developer options are unlocked (Yes, you literally tap on it until it unlocks developer settings).  You can also tap on the Android version for a nice easter egg.

** Turn these off when you get done developing.  Otherwise your phone might be vulnerable to getting viruses and the battery will get drained.

`` If your phone doesn’t connect as a USB device then go download your phone’s USB driver from their website.  (ex. I have a Samsung Galaxy S3, so i go to and download my driver).

Step 3: Launch Unity

  1. If you don’t have Unity installed then do that now at:
  2. Create a new project with the ‘standard assets (mobile)’ box checked.
  3. Go to Edit > Preferences… > External Tools and set the ‘Android SDK Location’ to ‘C:\Android\sdk’
  4. Hit play
  5. Look at your phone

Step 4: It still ain't workin'

Close Unity and Unity Remote, unplug your phone, turn all the developer settings off, and do the following steps in the order specified:

  1. Turn your developer settings back on.
  2. Plug your phone into the computer and wait for your computer to notice your phone.
  3. Turn on Unity Remote App.
  4. Launch Unity
  5. Press play

I hope that that worked for everyone. Connecting multiple programs and devices together is incredibly difficult and I probably only encountered half of the possible problems you could have.