Before you begin developing for Gear VR in Unity, you must set up your development environment.
You will need the following hardware to develop for Gear VR in Unity:
- Samsung Gear VR and Samsung Galaxy S7, Galaxy S7 edge, Galaxy Note 5, Galaxy S6 edge+, Galaxy S6, or Galaxy S6 edge.
- Samsung Gear VR Innovator Edition for Note 4 and Samsung Galaxy Note 4
- Samsung Gear VR Innovator Edition for S6 and Samsung Galaxy S6 or S6 edge
The following software is required for Gear VR development in Unity:
- Java SE Development Kit 8 (JDK)
- Android SDK 5.0 and SDK Tools
- Samsung USB Driver
- Unity 5.3.1f1 or later
NOTE: Oculus Mobile SDK 1.0.0 is now required for submission to the Oculus store. If using Unity v.5.2.2p4 or later, this version of the SDK is already included and does not have to be downloaded and manually integrated. If using an earlier version of Unity, you may need to update the Oculus Mobile SDK to the latest version.
Java SE Development Kit 8
- Navigate to the Java SE Development Kit 8 download page.
- In the Java SE Development Kit 8u31 section, select the Accept License Agreement radio button and download the Windows x86 or Windows x64 file.
TIP: To determine if your computer is 32-bit or 64-bit, right click Computer, then choose Properties to look at the System type. If your computer is 64-bit, download Windows x64. If it is 32-bit, download Windows x86.
NOTE: A newer version of the Java SDK may be available for download. You may choose to use the latest version. The last version tested for these tutorials was 8u40.
- Open the EXE file to install the JDK. Before installing the JDK, note the installation location.
- To ensure the JDK has been successfully installed, open a Command Prompt window, type the following command, and press Enter:
- Your current Java version will be displayed in the window.
- Open the Control Panel and navigate to System and Security > System > Advanced system settings.
NOTE: This setting may also appear at System > Advanced system settings.
- From the System Properties window, select the Advanced tab, then click the Environment Variables button.
- Locate the User variables section and click New.
- In the New User Variable window, complete the fields as follows:
- Variable name: PATH
- Variable value: C:[yourJDKpath]\bin
- Click OK (multiple times if necessary) to close out all dialogs.
Android SDK 5.0 and SDK Tools
To download and install the Android SDK:
- Navigate to the Android Studio and SDK Tools download page. Here you will be given the option to download Android Studio, which packages the official Android IDE and SDK tools, or to download a standalone package of the SDK Tools. For this tutorial, you only need the SDK Tools.
- Scroll down to the Download Options section. Under Get just the command line tools, locate the Windows platform and download the corresponding file.
- Launch the installer and follow the instructions to install the Android SDK Tools.
- At the end of installation, check the box to Start SDK Manager, then click Finish. This will open the Android SDK Manager.
- Check the boxes to select the following packages:
- Android Platform-tools (latest version)
- Android SDK Build-tools (latest version)
- Android 5.0.1 (API 21)
NOTE: When the Android SDK Manager launches, some packages may be pre-selected for installation. For this tutorial, you only need to install the packages above. If any of the pre-selected packages are not on this list, feel free to uncheck the items before starting the installation process.
- Click the Install button.
- In the Choose Packages to Install dialog, select a package on the left hand side and select the Accept License radio button. Once all licenses have been accepted, click the Install button.
Samsung USB Driver
To install the Samsung USB Driver:
- On your computer, navigate to the Samsung Download Center. Select Cell Phones, then select your device's carrier and model number from the dropdowns.
- Under Downloads, click the Download (EXE) button to download the USB driver for your device.
- Launch the EXE file and follow the instructions to install the Samsung USB Driver.
- When you connect your device to your computer via USB cable, your computer should recognize your device and display it as a removable device in Windows Explorer.
Unity 5.3.1f1 or later
- Download the latest version of Unity for Windows here.
NOTE: Unity 5.3.1f1 was used to create this tutorial series. You may experience issues if using an earlier version of Unity.
- Run the Unity Download Assistant and click Next.
- Accept the License Agreement, then click Next.
- On the Choose Components screen, make sure the following components are selected, then click Next.
- Unity 5.x.x
- Web Player
- Standard Assets
- Android Build Support
NOTE: You may choose to install additional components based on your development needs. However, the components above are the only components needed for this tutorial series.
- Launch Unity and sign into your Unity account. If you do not have an account, create one now.
- After activating Unity, the application will launch and prompt you to create a new project. At this point, you can close Unity and set up your device.
Set up your device for development
- Connect your Samsung Galaxy device to your computer via USB cable.
- From your mobile device, go to Apps > Settings.
- In Settings, scroll down to the SYSTEM section. If the Developer options menu is available, skip to Step 6. Otherwise, continue to Step 4 to enable Developer options.
- Scroll down, and tap Build number seven times. This will activate the Developer options menu on your device. Return to the main Settings screen.
- From the Developer options menu, navigate to DEBUGGING, and then enable USB debugging. A dialog box appears asking you to confirm. Tap OK.
- Another dialog box appears. Check the box next to Always allow this computer, then tap OK.
- Open a Command Prompt window from your computer and type the following command to navigate to your Android SDK's /platform-tools directory:
- Type the following command to confirm that a device has been connected to your machine:
Retrieve Your Oculus Signature File
Oculus requires that all applications accessing VR functionality use a unique signature file created with a specific Device ID. This signature file will access low-level device functions through APIs provided in the Oculus Mobile SDK. Use one of the following methods to retrieve your Device ID.
NOTE: If you completed the previous procedure, you may already have a Command Prompt window open showing your device and Device ID. Copy the Device ID and continue to Download the Oculus Signature File.
- With your device connected to your computer, open a Command Prompt window.
- Navigate to the /platform-tools directory in the Android SDK with the following command:
- Type the following command to retrieve your Device ID:
- Copy your Device ID.
You can also retrieve your Device ID using a mobile app. Download and install the SideloadVR Device ID app available from Google Play™, developed by Mark Schramm. Once installed, open the app and copy your Device ID.
Download the Oculus Signature File
- Navigate to the Oculus Signature File Generator and sign into your Oculus account. If you do not have an account, create one now.
- After logging into your account, paste your Device ID into the form field and click the Download File button. Your signature file will be downloaded. Be sure to keep this file in a location that can be easily accessed.