Enabling Virtual Reality for your platform
The diorama scene we created in the previous chapter was a 3D scene using the Unity default Main Camera. As we saw, when you pressed Play in the Unity Editor you had the scene running in the Game window on your 2D computer monitor. The steps for setting up your project to run in VR include:
- Set the target platform for your project builds
- Enable Virtual Reality in the XR Player Settings in Unity and set the VR SDK
- Import the device toolkit for your target device into your project (optional but recommended) and use the prescribed prefabs instead of the default Main Camera
- Install the system tool required to build your target device
- Ensure your device's operating system is enabled for development
- Ensure your device's VR runtime is set up and running
If you are not sure, use the table to determine the target platform, virtual reality SDK, and Unity package to use for your VR device:
Links to the Unity packages for various integration toolkits are listed as follows:
- SteamVR Plugin: https://assetstore.unity.com/packages/tools/steamvr-plugin-32647
- Oculus Integration: https://assetstore.unity.com/packages/tools/integration/oculus-integration-82022
- MixedRealityToolkit-Unity: https://github.com/Microsoft/MixedRealityToolkit-Unity
- Google VR SDK for Unity: https://github.com/googlevr/gvr-unity-sdk/releases
- Google Daydream Elements: https://github.com/googlevr/daydream-elements/releases
Now, let's configure the project for your specific VR headset.
As you know, installation and setup details are subject to change. We recommend you double-check with the current Unity manual and your device's Unity interface documentation for the latest instructions and links.