Download the Google VR SDK for Unity
- Download the latest GoogleVRForUnity_*.unitypackagefrom the releases page.
Enabling see-through mode via the Unity prefab
- Add the GoogleVR > Beta > Prefabs > GvrBetaHeadset prefab to your scene.
Note: GvrBetaHeadsetsupersedesGvrHeadset. If theGvrHeadsetprefab is present in your scene, remove it.
- Select the GvrBetaHeadsetobject in the scene.
- Using the component inspector for GvrBetaHeadset, configure see-through mode to be used at the startup of your scene.
Enabling see-through mode via APIs
- Check to see if the system supports see-through mode and if it is enabled using the class - GvrBetaSettings, its methods- IsFeatureSupported(...)and- IsFeatureEnabled(...), and the enum- GvrBetaFeature.SeeThrough.
- If it is supported but not enabled, request the user enable it by calling - GvrBetaSettings.RequestFeatures(...)with an array containing the enum- GvrBetaFeature.SeeThrough.- bool supported = GvrBetaSettings.IsFeatureSupported(GvrBetaFeature.SeeThrough); bool enabled = GvrBetaSettings.IsFeatureEnabled(GvrBetaFeature.SeeThrough); if (supported && !enabled) { GvrBetaFeature[] features = new GvrBetaFeature[] { GvrBetaFeature.SeeThrough }; GvrBetaSettings.RequestFeatures(features, null); }- The - GvrBetaHeadsetclass provides the- CameraModeand- SceneTypeproperties that let you set see-through mode and scene type, respectively. You can also use- SetSeeThroughConfigto set both properties simultaneously.- GvrBetaHeadset.SetSeeThroughConfig(GvrBetaSeeThroughCameraMode.RawImage, GvrBetaSeeThroughSceneType.Virtual);
To ensure your scene composites with see-through mode properly, make sure the Clear Flags option for the main camera is set to Solid Color and the Background color is set to black with 0 Alpha.