Getting started with Unity for see-through mode

Download the Google VR SDK for Unity

  • Download the latest GoogleVRForUnity_*.unitypackage from the releases page.

Enabling see-through mode via the Unity prefab

  1. Add the GoogleVR > Beta > Prefabs > GvrBetaHeadset prefab to your scene. Note: GvrBetaHeadset supersedes GvrHeadset. If the GvrHeadset prefab is present in your scene, remove it.
  2. Select the GvrBetaHeadset object in the scene.
  3. 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

  1. 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.

  2. 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 GvrBetaHeadset class provides the CameraMode and SceneType properties that let you set see-through mode and scene type, respectively. You can also use SetSeeThroughConfig to 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.