Unity - Testing on iPhone

From NoskeWiki
Jump to navigation Jump to search


NOTE: This page is a daughter page of: Unity

Unity is cross-platform game engine and authoring tool. This page represents my own personal notes on how to publish from Unity on a Mac onto an iPhone for testing. It assumes you've already downloaded Unity and created a project with one scene (any project will do). It also assumes you're willing to pay the $100 required for a one year Apple iOS license (independent of Unity).

As you'll notice, the focus I had here was to just get "something working", and eventually I managed to do it. At the time I had no interested in actually publishing to AppStore... if I ever do I'll be sure to update these instructions. Be warned that there are a lot of YouTube videos that claim to show you the process, but I'm yet to find a useful one!

Last updated: Sep 2014 (see bottom of page)

Deploying Unity from Mac to an Android Phone App

Generally, you must follow these vague instructions here: http://docs.unity3d.com/Manual/iphone-accountsetup.html
These official instructions link you to a bunch of other instructions, so I've written a shorter version of all these instructions here:

  • Go to the Apple Dev Center iOS Download page > Download latest build of iOS SDK … and this will get you to download the latest Xcode. Install it.
    Note: If not already it will ask you to to create a dev account, this should be quick and pretty instant - it's adding adding a license that takes a little longer.
  • Open Xcode.
  • Plug your iPhone into your Mac computer/laptop (into a USB port), and when it pops up with the "Organizer - Devices" window for your phone turn on the "Use for Development" option.
  • At this point you'll be asked to sign up for $99/year for a Developer license. No way around this, although each license is good for I believe 100 Developer devices? Sign up for a license.
  • Your phone should now show up in "Organize - Devices" window with a "console", "provisional profile" and other little options below it. Before Unity can build to the device you need a "Provisional Profile" which links a certificate to your testing phone... and this is the hard part:
    • Go to your Apple Dev Account Portal.
    • Add a "developer account" - click "+" to add your phone to your developer account.
      • The DCID it asks for is the big long address which looks like: "3fa546cfb41ef2f48a96087aaf00e160fc86fe8a"
    • Add a "certificate" - click "+" to create a certificate to your developer account.
      • This includes tricky keychain instructions, but hopefully you can survive this.
      • Download and save the .cer file to somewhere safe (I saved it to /Developer/Dev_Certs" then backed it up to Google Drive).
    • Add a "Provisional profile" which links the certificate to your device and other preferences. This is the hard part. Click "+" to get started and create a minimal setup with as few trimmings (store purchases etc) as possible. When asked for a bundle id I called the thing "com.myfakecompany.myappname".
      • Note that it will add an extra string in front (for example: "7NQJ6BHMLD.com.myfakecompany.myappname").... copy this "Bundle Identifier" into a text file the moment it appears.
      • Download and save the MyProvisional.mobileprovision file to the same folder as your .cer and text file.
  • Go to Xcode / "Organize - Devices" and under your device, click "Provisional Profile". Click the "+" arrow and locate your MyProvisional.mobileprovision file.
  • Back in Unity click: File > Build Settings, select the iOS tab, select "Development Build" and then click "Player Settings…". In the Inspector window, expand "Other Settings" and copy in the Bundle Identifier string (the one with random characters in front) from before. You should now be able to hit "Build and Run"… and if you iPhone is still plugged in, the application will appear and open directly on your phone.
  • Thank the gods when you finally get this all working.
  • Now's a good time to add a default icon (a good sized PNG with transparency works) to the "Player Settings", adjust the game, and try building again.