IPhone Getting Started with the UnityRemote

From Unify Community Wiki
Jump to: navigation, search

This tutorial is still VERY rough but hopefully they will still be helpful in its current form.

If you have a minute and know your way around wiki formatting, please feel free to beautify this page.

NOTE: I didn't think to start writing this until after I was done registering, so if you are following this tutorial and you notice something that I missed, PLEASE help out by extending this tutorial with whatever you figure out. At the moment, almost everyone is having problems getting things configured the first time.


Register & Download

  1. Register as an iPhone Developer, if you have not done so already. This part does not cost anything, and will allow you to download the iPhone SDK and view all the developer documentation for the iPhone. You will find the links on the Apple Dev Center page.
  2. Download the iPhone SDK (~1.6GB) from the Apple iPhone Dev Center. The SDK includes the latest XCode toolset, so there is no need to install it separately.
  3. Enroll in the iPhone Developer Program. There are two options here: $99 for the Standard Program, and $299 for the Enterprise Program. Most will want to choose the Standard program, For developers who are creating free and commercial applications for iPhone and iPod touch and want to distribute applications on the App Store. The difference between the two programs is that you can use the Apple Enterprise Program for in-house distribution on a large number of devices, For companies with 500 or more employees who are creating proprietary in-house applications for iPhone and iPod touch.
    • Icon warning.gif VERY IMPORTANT: When applying, you will be presented a choice for registering as a company or as an individual. Choose carefully here, because you will not be able to switch easily. If you already have your own business setup, you will most likely want to choose company
    • Icon warning.gif SEE *NOTE BELOW Re: Company vs. Individual Choices v/v getting started and getting your certificate fast.
  4. Wait until you get an email from Apple that lets you activate your iPhone program portal. It can take a day to a week for Apple to authorize individuals and last report was that companies can take as long as three months to be registered. (I actually had to call the apple store at 1-800-MyApple and get transferred to the small business people who transferred me to the iPhone dev people who fixed the email for me when I still couldn't get in after a week). [A list of ADC contact numbers can be found here: http://developer.apple.com/contact/phone.html]
  5. Send an email to Unity and request a Unity iPhone evaluation. A real person has to read your email so again this may take a few days.

  • NOTE [Little Angel]: If you sign up as a company you will be required (at least in the UK) to send full documentation to Apple to prove your company exists and is valid. [Presumably to prevent account sharing amongst a group of individuals pretending to be a company, thus losing revenue for Apple.] As of one week out from applying as a company, I had received no communication from Apple what so ever, so I called them directly. (This is not difficult. In the Apple iPhone Dev Center there is a small "Contact Us" link at the bottom right of the page that takes you to: http://developer.apple.com/contact/. If you choose "call us" you will go here: http://developer.apple.com/contact/phone.html where there is a list of telephone numbers for each localization.) I reached a representative immediately, and they were very helpful. I was informed that Apple were still "processing my information" and "would require full documentation on my company when they contact me". I'd have to get all of the docs together (time) and this could take weeks for Apple to approve once they had received them (more time) after they contact me to ask for the documents (even more time). To get the cert. immediately, we had the representative withdraw my company application and I reapplied online as in individual. This is merely an Apple Store purchase and I was confirmed immediately. They said the authorization should take less than 24 hours to arrive, and it did. The only hook was that I had to call the next day (see contact info page) to confirm my identity. They could have asked for a copy of my photo-id be sent to them, but we were able to verify my over the phone. Icon warning.gif THE PROBLEM: Time. Eventually, once I get my company documentation together, I will have to call them again and have them manually change over from a personal account to a company account pending the submission of the documentation. This could take weeks. However, most of this will be the weeks that it would have taken to approve a company regardless, and I have my cert. to start dev'ing now. So - complicated. I chose, even tho' I have a company, to go as an individual for now to get started; as without the cert, you can't dev. with the device as a remote.

Register your Device & Fetch App ID

Icon warning.gif READ the HOW TO Tab on each page along side this tutorial.

Follow this guide and look at the ADC Program Portal Page:

  1. Sign in to the iPhone Dev Center page of the Apple Developer Connection page.
  2. Click on the program portal button. It will show up as a button on the right side of your iPhone Dev Center page. This button only appears when your authorization is complete and can take that week or so to get access to.
  3. If you have registered as a company, then in the program portal, click on "Team" and register yourself (here and elsewhere in the program portal there is a "How To" tab that holds context-sensitive help information for the current task). (If you've registered as in individual, you will already be registered as the only possible team member.)
  4. Click on "Certificates" and create a certificate that will be used to sign your application. I found the instructions on the "How To" tab were enough to get me going. Icon warning.gif IMPORTANT: Follow the instructions in the HOW TO and the following: *If you do not have the WWDR intermediate certificate installed, click here to download now. This step is important.
  5. Find the device ID of your iPhone or iPod Touch. You can find out your device's UDID using iTunes 7.7. or later. To do this, connect your device to your Mac and launch iTunes. In iTunes, select your device in the 'Devices' section and navigate to the Summary tab. Click on the Serial Number LABEL to reveal the Identifier field and the 40 character UDID. Do not click on the serial number itself. This will do nothing. Click on the label itself. Press Command+C to copy the UDID to your clipboard. (The UDID will not highlight and does not seem to be selectable. Pressing Command+C will copy the UDID.)
    • Icon warning.gif VERY IMPORTANT: later on, you need to download this certificate to your Mac so that xcode can use it to sign your projects. No code can go onto an iPhone until it is signed. After you create a certificate you will see a button on the Certificates tab that lets you download it to your machine. Click on the "Download" button and install the downloaded certificate by double-clicking on it. This will launch the Keychain Access application. Make sure you install to the login chain which should be selected by default.
  6. Click on "Devices" and add your device using the code that you copied out of iTunes above.
  7. Click on "App IDs" and add an ID. This is one of the steps that people commonly get wrong. First, App IDs need to be based on domain names (but backwards) and second they need to end in ".*" so if you have the domain waffles.com you want to list your App ID as com.waffles.*. When you are done and the App ID shows up in the list on the main page, Apple will have added a random identifier to the front of your text so that it will look like 8dbg88ga98gf89g.com.waffles.*. Icon warning.gif BE AWARE that the trailing * is important to the App ID. The name (e.g.:com.waffles) will be for your company or brand name. The "*" (e.g.: in com.waffles.*) will be for your application name. This Bundle Identifier will need to match whatever CF Bundle Identifier you use for your application in Xcode: (com.domainname.applicationname).
  8. Click on "Provisioning" and create a provisioning profile. Again, I used the "How To" tab.
    • Icon warning.gif VERY IMPORTANT: you will need to add the provisioning information to your xcode project. Download the provisioning information using the "Download" button.

Don't worry about the "Distribution" tab yet.

Setup Unity iPhone

  1. Launch the Unity iPhone app and see the sample project
  2. In the upper right hand corner of the view you will see the Player Prefs (you can find these later via Edit->Project Settings->Player). You need to change the iPhone Bundle Identifier to get it to match both your App ID and to match the identifier in the xcode project (which we'll be modifying shortly). Assuming your App ID was 8dbg88ga98gf89g.com.waffles.* you want to change the iPhone Bundle Identifier to com.waffles.UnityRemote
  3. In the finder, double-click on Applications/Unity iPhone/Unity Remote/UnityRemote.xcodeproj
  4. With your iPhone connected to your Mac, you should see the device listed in the xcode Organizer window.
  5. Select the device in the xcode Organizer and click + to add a new provisioning to the device. Browse to the provisioning file you downloaded earlier.
    • Icon warning.gif NOTE: If you have followed the instructions in provisioning "How To" tab, you will have dragged the provisioning file onto iTunes or xCode, and this file will already be present in the provisioning profiles tab in the left hand side bar, and there will be no need to click + to add these files. You should simply be able to drag the provisioning profile you want from the left sidebar into the provisioning window. As a precaution, I had restarted both the iPhone and xCode, and the files were automatically within the Provisioning Section of the Organizer Summary without any action on my behalf when both xCode and iPhone restarted.
  6. At this point, I was getting certificate not found warnings and had to power-cycle my iPhone to get it to register (hold the button at the top of the phone down for 5 seconds to power off, then repeat to power on) and I may have had to close and re-launch xcode but after that everything was fine.
  7. From the xcode Window menu, select UnityRemote.xcodeproj (or if you had to close and restart xcode open it from the recent projects menu item)
  8. Select Device (rather than Simulator) as the build target in the popup at the top left of the Xcode window.
  9. In the treeview, open Targets and select UnityRemote, then right-mouse-click and select Get Info. Go to the Properties tab and change the Identifier (NOTE: this is another one of the steps that people frequently get wrong). This identifier needs to match whatever you put in the iPhone Unity Player Settings iPhone Bundle Identifier field, which is this example is com.waffles.UnityRemote

Establish Network Connection

  1. Click on the Air Port icon in your main menu bar and "Create Network..." to set up a wifi network (with a password) that you iPhone can connect to.
  2. on the iPhone, click on Settings and join the new wireless network.
  3. Check your firewall settings. Under Leopard you need to either select "Allow all incoming connections" or select "Set access for specific services and applications" and be sure to add Unity iPhone with "Allow incoming connections".

Run UnityRemote

  1. Go back to xcode, find the UnityRemote.xcodeproj window, and click the "Build and Go" button. xcode should build and sign your app and then you will see a notice on your phone that it is waiting for you to hit play in the editor.
  2. Switch to the Unity editor window and hit the play button in the lower-left-hand corner of the window.
  3. If you've done everything correctly, you should now be flying a ship around on your phone. Note that what you see on the iPhone/iPod may be blurry. This is because Unity Remote is streaming images rendered by Unity Editor to the device. The blurriness is a result of compression artifacts.
Personal tools