Unity Setup

  1. Download and install Unity. The personal edition is fine for this class.
  2. Download and install Java 8 SE JDK
  3. Download and install Android SDK.
  4. Download the Cardboard SDK for Unity by clicking the “Direct Link to Unity Package.”
  5. Open Unity app. Create an account if necessary, and create a new project called HelloUnity. Make sure you choose 3D project.
  6. On the Menu Bar, select Unity -> Preferences -> External Tools
  7. This gets a little bit tricky on the Mac… You need to tell Unity where the Java JDK and the Android SDK are located, but both of these are buried in hidden folders. You will need to open up Terminal to find these folders and set them in Unity.
    1. In Terminal, run the following commands:
      1. chflags nohidden /Library
      2. chflags nohidden ~/Library
    2. The library folders are now visible in the finder.
    3. The Android SDK is located at ~/Library/Android/sdk
    4. The Java JDK is located at /Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home
  8. Install the Cardboard SDK. On the Menu Bar, go to Assets -> Import Package -> Custom Package… and select the Cardboard SDK Unity Package.
  9. Choose “Import All”.
  10. In the Project window’s Assets folder, go to Cardboard/Prefabs.
  11. Drag the CardboardMain prefab into the hierarchy.
  12. Delete the original MainCamera from the hierarchy.
  13. Select CardboardMain in hierarchy and set position to 0,1.6,0. This moves the camera up to around 1.6 meters, a good average height for a human’s eyes.
  14. You are now ready to build your VR scene.
  15. When you are done and are ready to export to an external device, go to the menu bar and choose File -> Build Settings…
  16. Select Android Platform and choose Switch Platform.
  17. When platform switch is done, choose Player Settings… from the build window.
  18. Most of the defaults are fine, but you will need to change some player settings.
    1. Company Name: Anything you like (let’s use NYU IDs)
    2. Product Name: the name that will appear on the phone’s Home Screen
    3. Go to “Other Settings”
      1. bundle Identifier: reverse URL. It needs to be unique and by convention is the company’s website + the product name. We can make it something like edu.nyu.itp.ck987.terrain . Alphanumeric characters only. No hyphens.
      2. Minimum API level: Android 4.4 KitKat (Api level 19)
    4. Resolution and Presentation:
      1. Orientation/ Default Orientation: Landscape Left (this will keep the image from Auto-Rotating)
  19. Plug in your Android Phone to your computer’s USB port.
    1. You may need to turn on developer mode and enable USB Debugging. If Unity is complaining that it can’t find the phone, follow these directions to enable developer Mode. 
    2. After Developer Mode is enabled, you should see “Developer Options” in your phone’s Settings App. In the Developer Options you can enable USB Debugging.
  20. Choose Build and Run. Save the APK. I like to save the APKs to a separate folder so that the APK doesn’t get bundled into my project. But it’s up to you.
  21. If everything is set up correctly, your scene should show up on your phone! The app is also installed on the phone and can be started like any other app.