November 6, 2019 update:
- There's a new open source Cardboard SDK that offers a streamlined API, improved device compatibility, and built-in viewer profile QR code scanning. We recommend that all developers actively building for Google Cardboard migrate to the new Cardboard SDK: iOS, Android NDK, Unity XR Plugin (SDK)
Oh, and don't forget that Unity is free and we have fully-functional 30-day trials available for Unity Pro and Unity iOS Pro! Our application built in Unity uses ARKit/FaceTracking on iOS. We would like to request the Camera Permission at runtime immediately before it is used - and not on application startup. What should happen I use Application.RequestUserAuthorization immediately before the camera is used. Accessing iOS functionality Unity provides a number of scripting APIs to access the multi-touch screen, accelerometer, device geographical location system and much more. You can find out more about the script classes on the iOS scripting page. Exposing native C, C or Objective-C code to scripts. Unity Plus, Pro and Enterprise subscription plans all include the core Unity real-time development platform, continuous updates, beta access, and more - all royalty-free. Compare plans to see the different features, resources, services, and options you can get with each plan, and to determine your eligibility. See all Subscription FAQs.
October 15, 2019 update: - The Daydream View VR headset is no longer available for purchase. However, you can continue to use the existing Google VR SDK to update and distribute your apps to the Google Play Store, and make them available to users in the Daydream app.
This guide shows you how to set up Google VR development with Unity and build ademo Cardboard app for iOS.
Set up your development environment
Hardware requirements:
- You'll need an iPhone 5 or higher, running iOS 8.0 or higher.
- You'll need a Cardboard viewer.
Software requirements:
- Install Unity:
- Recommended version:LTS release 2018.4 or newer
- Minimum version: 5.6
Make sure that the iOS Build Support component is selectedduring installation. - Make sure your environment is configured for iOS development.Refer to Unity's guide for Getting started with iOS development.
Download the Google VR SDK for Unity
- Download the latest
GoogleVRForUnity_*.unitypackage
from thereleases page.The SDK includes the following demo scenes for Cardboard:Scene Description HelloVR Simple VR game in which you find and select a cube
Create a new Unity project and import the Google VR Unity package
- Open Unity and create a new 3D project.
- Select Assets > Import Package > Custom Package.
- Select the
GoogleVRForUnity_*.unitypackage
file that you downloaded. - In the Importing Package dialog, click Import.Accept any API upgrades,if prompted.
Configure build settings and player settings
- Select File > Build Settings.
- Select iOS and click Switch Platform.
- In the Build Settings window, click Player Settings.Configure the following player settings:
Setting Value Player Settings >Other Settings >Virtual Reality Supported Enabled Player Settings >Other Settings >SDKs Click + and select Cardboard Player Settings >Other Settings >Target minimum iOS version 8.0 or higher Player Settings >Other Settings >Bundle Identifier Follow reverse the DNS format suggested by Apple
Preview the demo scene in Unity
- In the Unity Project window, go to Assets > Google VR >Demos > Scenes. Open the HelloVR scene.
- Press the Play button. In the Game view you should see arendered demo scene.Note that although the scene here is monoscopic, the rendering on yourphone will be stereo.
- Interact with the scene using simulation controls:
Type Simulated action What to do Head movement Turn your head Hold Alt + move mouse Tilt your view Hold Control + move mouse Cardboard input Button press Click anywhere in the Game view
Build and run the demo scene on your device
- Connect your phone to your computer using a USB cable.
- Select File > Build and Run.Unity builds your project and opens the generated Xcode workspace.Note: If you use Build Settingsā¦ > Build to build your project, besure to open the generated
*.xcworkspace
workspace file in Xcode, notthe included*.xcodeproj
project file. Opening the project file willresult in build errors. - Put the phone in your viewer and try out the demo.
Next steps
Unity Ios C#
- Learn more about the SDK capabilities.
- Learn more about Spatial Audio.