This site has been permanently archived. The content on this site was last updated in 2019.
Getting started with Unity for see-through mode
Stay organized with collections
Save and categorize content based on your preferences.
Download the Google VR SDK for Unity
- Download the latest
GoogleVRForUnity_*.unitypackage
from the
releases page.
Enabling see-through mode via the Unity prefab
- 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.
- Select the
GvrBetaHeadset
object 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 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.
All rights reserved. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-09 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-09 UTC."],[[["\u003cp\u003eDownload the latest Google VR SDK for Unity to integrate virtual reality features into your Unity projects.\u003c/p\u003e\n"],["\u003cp\u003eEnable see-through mode in your VR applications using either the provided Unity prefab or by directly interacting with the Google VR APIs.\u003c/p\u003e\n"],["\u003cp\u003eEnsure proper scene compositing with see-through mode by configuring the main camera's clear flags to solid color and setting the background to black with 0 alpha.\u003c/p\u003e\n"],["\u003cp\u003eUtilize the \u003ccode\u003eGvrBetaHeadset\u003c/code\u003e class to control camera mode, scene type, and other see-through related settings for a more immersive experience.\u003c/p\u003e\n"]]],["First, download the `GoogleVRForUnity_*.unitypackage` from the releases page. To enable see-through mode via the Unity prefab, add the `GvrBetaHeadset` prefab to the scene and configure see-through mode in its component inspector. Alternatively, use APIs: check if `GvrBetaFeature.SeeThrough` is supported and enabled using `GvrBetaSettings`, request it with `RequestFeatures` if needed, and utilize `GvrBetaHeadset`'s properties or `SetSeeThroughConfig`. Ensure the main camera's **Clear Flags** are set to **Solid Color** with a black background and 0 Alpha.\n"],null,["# Getting started with Unity for see-through mode\n\nDownload the Google VR SDK for Unity\n------------------------------------\n\n- Download the latest `GoogleVRForUnity_*.unitypackage` from the [releases page](//github.com/googlevr/gvr-unity-sdk/releases).\n\n### Enabling see-through mode via the Unity prefab\n\n1. Add the **GoogleVR \\\u003e Beta \\\u003e Prefabs \\\u003e GvrBetaHeadset** prefab to your scene. Note: [`GvrBetaHeadset`](/vr/reference/unity/class/GoogleVR/Beta/GvrBetaHeadset) supersedes [`GvrHeadset`](/vr/reference/unity/class/GvrHeadset). If the `GvrHeadset` prefab is present in your scene, remove it.\n2. Select the `GvrBetaHeadset` object in the scene.\n3. Using the component inspector for `GvrBetaHeadset`, configure see-through mode to be used at the startup of your scene.\n\n### Enabling see-through mode via APIs\n\n1. Check to see if the system supports see-through mode and if it is enabled\n using the class [`GvrBetaSettings`](/vr/reference/unity/class/GoogleVR/Beta/GvrBetaSettings),\n its methods [`IsFeatureSupported(...)`](/vr/reference/unity/class/GoogleVR/Beta/GvrBetaSettings#isfeaturesupported)\n and [`IsFeatureEnabled(...)`](/vr/reference/unity/class/GoogleVR/Beta/GvrBetaSettings#isfeatureenabled),\n and the enum [`GvrBetaFeature.SeeThrough`](/vr/reference/unity/namespace/GoogleVR/Beta#gvrbetafeature).\n\n2. If it is supported but not enabled, request the user enable it by calling\n [`GvrBetaSettings.RequestFeatures(...)`](/vr/reference/unity/class/GoogleVR/Beta/GvrBetaSettings#requestfeatures)\n with an array containing the enum [`GvrBetaFeature.SeeThrough`](/vr/reference/unity/namespace/GoogleVR/Beta#gvrbetafeature).\n\n bool supported = GvrBetaSettings.IsFeatureSupported(GvrBetaFeature.SeeThrough);\n bool enabled = GvrBetaSettings.IsFeatureEnabled(GvrBetaFeature.SeeThrough);\n if (supported && !enabled)\n {\n GvrBetaFeature[] features = new GvrBetaFeature[] { GvrBetaFeature.SeeThrough };\n GvrBetaSettings.RequestFeatures(features, null);\n }\n\n The [`GvrBetaHeadset`](/vr/reference/unity/class/GoogleVR/Beta/GvrBetaHeadset)\n class provides the [`CameraMode`](/vr/reference/unity/class/GoogleVR/Beta/GvrBetaHeadset#cameramode)\n and [`SceneType`](/vr/reference/unity/class/GoogleVR/Beta/GvrBetaHeadset#scenetype)\n properties that let you set see-through mode and scene type, respectively.\n You can also use [`SetSeeThroughConfig`](/vr/reference/unity/class/GoogleVR/Beta/GvrBetaHeadset#setseethroughconfig)\n to set both properties simultaneously. \n\n GvrBetaHeadset.SetSeeThroughConfig(GvrBetaSeeThroughCameraMode.RawImage,\n GvrBetaSeeThroughSceneType.Virtual);\n\nTo ensure your scene composites with see-through mode properly, make sure the\n**Clear Flags** option for the main camera is set to **Solid Color** and the\n**Background color** is set to black with 0 Alpha."]]