Google Daydream is one of the most accessible ways to get into VR, with a comfortable headset, a low price point and wide compatibility with a huge range of mobile devices. This makes it a great choice for VR development, but first we’ll have to put it into developer mode. We’ll take you through the steps you need to know so you can get started developing for VR!
First, you’ll want to make sure to set up your mobile device for development by following our guide here, or you run the risk of missing key Unity components. Check it out, then come back to get into Unity!
15 Steps to Set Up Unity for Google Daydream
First of All, You Need to Get Ready
1. Let’s make sure your headset is ready to go.
2. Next, you need to make sure you have Unity. (It’s a pretty essential component of setting up Unity for mobile VR development.) If you don’t have it installed on your computer, download it here and follow the setup guide to install it on your machine.
3. If you run into any issues, check out our guide to getting started in Unity. Still struggling? Book a free setup with our team and we’ll walk you through it.
Change Your Settings: Add Open Scenes
4. Once you have Unity installed, open it up. We’re going to go through and adjust a bunch of settings so that you can access everything you need to develop for mobile VR.
5. The first thing we need to do is add open scenes. Head up to the File menu and choose “Build Settings,” then click on “Android” in the platform settings list. If the Android option doesn’t show up for you, make sure you set your project up for mobile development when you set up your mobile device. After you’ve clicked on the Android platform option, click “Add Open Scenes” on the right-hand side of the window.
6. Back to “Build Settings.” This time, we’re setting up the project name. In the Build Settings window (accessed through the File menu, just like in the previous step), click on “Player Settings…” at the bottom. You may notice something change in the main Unity window behind the menu. Perfect!
Change Your Settings and Add Your Android Device
7. Close the Build Settings window. Head into your Inspector tab (on the right-hand side of the main Unity window), which should now show Player Settings. Open the collapsed “Other Settings” menu and scroll to the Identification options. In the “Package Name” field, enter a unique product name. You can make up anything you want, but it has to follow the convention “.com.something.something.”
8. Now, expand the XR Settings menu in the Inspector (which should still be showing Player Settings). Next to the words “Virtual Reality Supported,” click in the empty box. This should now turn into a checked box, indicating that virtual reality is supported for this build. Click on the plus sign that just appeared underneath and add Daydream to the list. In the same area of XR settings, choose the Minimum API Level for Daydream: Android 7.0 ‘Nougat’ (API level 24).
9. In the Edit menu, navigate to “Project Settings” and then click on “Editor.” Again, your Inspector will change, but this time it’ll show the current Editor Settings. Click the dropdown menu next to “Device” and select “Any Android Device.”
Download and Adjust the Right Tools
10. Now we need to incorporate Google’s VR tools into our project. Head into your browser and download the latest GoogleVRForUnity_*.unitypackage here. Then return to Unity and navigate to the Assets menu. In the “Import Package” list, select “Custom Package.” A window will pop up. Find your downloads folder, then find the file that you just downloaded. (It’ll look something like this: GoogleVRForUnity_*.unitypackage.)
11. Unity will open the package and display an “Import Unity Package” menu. Click “Import” at the bottom of the window and go grab yourself a coffee while you wait for Unity to do its thing. (It won’t take long.)
12. Now, we’re going to repeat the previous step for a couple of other packages you’ll need in order to develop for Daydream. First, download and install Android SDK Tools. Then, do the same for Java SE Dev Kit.
13. In the Edit menu, select Preferences to open the Unity Preferences window. Click on the tab for External Tools, and click on the download button next to the NDK field.
14. After the zipped file has downloaded, extract it in your file manager. Then head back into Unity, click “Browse” next to NDK and locate the extracted file. Select it. We’re done with the NDK. Now, hit the browse button next to the SDK path. Why aren’t we downloading it first? Simple. As long as you’ve already set up your mobile device, you already have the SDK on your computer! In the browse window, you’ll want to select the root folder for the SDK directory. It should look something like this: C:\Users\your username\AppData\Local\Android\Sdk.
Load Up That Scene!
15. Let’s load the demo scene! Go to your Assets tab. (It’s the area that fills the bottom of the main Unity window). Make sure “Assets” is highlighted on the left, then navigate to the GoogleVR folder, then to Demos, then Scenes. Now double click on “GVRDemo” to load the demo scene.
|Download our 10-week VR Development with Unity Course Syllabus|
If You Are Having Trouble
An error window may pop up stating that Unity was unable to find a list of devices. No problem! We need to delete a file in your SDK root folder, so first let’s figure out where that is. Open Edit > Preferences and click on the External Tools tab. The file you want is in the SDK field. Copy and paste that location, or navigate to it, in your File Explorer or Finder.
In your File Explorer, in that main SDK root folder, delete the Tools folder. Then download SDK tools. After the file is done downloading, extract it and move it to that main Android SDK root folder you deleted the other Tools folder from. Perfect! You should now be able to build and run your project in Unity.
When building you project and you come across an error stating it was unable to find a list of devices.
- Delete android sdk “tools” folder : Sdk > tools
- Download SDK Tools: http://dl-ssl.google.com/android/repository/tools_r25.2.5-windows.zip
- Extract that to Android SDK root
- Build settings > Build and run
- Make sure your mobile device is set up: circuitstream.com/mobile-vr-setup
- Go to Build settings and switch platform to android/ios //and add open scenes.
- In Player Settings > Other Settings>Bundle Identification and enter a unique product name in package name.
- Now open XR Settings and check Virtual Reality Supported. Click the plus sign and add DayDream to the list.
- Go to Build settings > Player Settings > XR Settings and select Minimum API Level for Daydream: Android 7.0 ‘Nougat’ (API level 24).
- Go to Edit > Project Settings > Editor > Device and select Any Android Device.
- Download the latest GoogleVRForUnity_*.unitypackage from github.com/googlevr/gvr-unity-sdk/releases
- Select Assets > Import Package > Custom Package.
- Select the GoogleVRForUnity_*.unitypackage file that you downloaded.
- In the Importing Package prompt, click Import.
- Download and Install Android SDK Tools: developer.android.com/studio/index.html
- Download and Install Java SE Dev Kit: oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
- Go to Edit > Preferences > External Tools and click download next to NDK, extract the zip file where you want and select the directory for the newly extracted root folder of the ndk after clicking browse next to NDK in Unity.
- Go to Edit > Preferences > External Tools and select browse next to SDK, select the root folder for the sdk directory. Default: C:\Users\your username\AppData\Local\Android\Sdk
- Load the demo scene. Assets > GoogleVR > Demos > Scenes > GVRDemo