Get Started with OVRSceneManager (deprecated)
Updated: Jun 26, 2024
OVRSceneManager Deprecation
As of v65, OVRSceneManager is deprecated. New features will be delivered through MR Utility Kit. Refer to the following as guidance on which APIs to use:
New projects:
Existing projects:
This page outlines the steps required to Get Started with Scene, in order for a developer to have a basic working version of Scene running in Unity.
Before you begin working with Scene, do the following:
- Set up your Unity development environment and configure your Quest headset.
- Verify that your headset is running the latest OS version. In the headset, go to Settings > System > Software Update and update if necessary. Scene requires OS v40 or higher.
- Set up a new Unity project following the guide Create Your First VR App on Meta Quest Headset.
- Optionally, set up Meta Quest Developer Hub and Link.
In order for a Unity project to use Scene, we need to enable permissions which allow access to Scene data. We modify permissions using the OVRCameraRig prefab.
- Create a new Unity scene, or open an existing one from your project.
- Remove the Main Camera from your scene.
- Add the OVRCameraRig prefab. Search for OVRCameraRig in the Project tab, and drag it into your scene.
- If you use the Project Setup Tool, you will receive automatic warnings and suggested fixes for the permissions.
To set permissions manually, select OVRCameraRig in the Hierarchy tab. In the Inspector tab, under the OVRManager component, do the following:
a. Under the Quest Features > General tab, find Scene Support and select either Required or Supported.
b. When selecting Scene Support, Anchor Support should automatically be enabled.
c. Further below, find the section Permission Requests On Startup, and toggle the Scene checkbox. This will request the permission when the app starts.
- In the toolbar, select Meta > Tools > Create / Update AndroidManifest.xml. This will create/update the AndroidManifest.xml to let the OS know that your app would like to use the Scene permission.
The easiest way to interact with Scene is with the OVRSceneManager prefab. This prefab will help query the Scene data from the OS, and spawn game objects for the various Scene anchors in your space.
- Add the OVRSceneManager prefab. Search for OVRSceneManager in the Project tab, and drag it into your scene.
- In the Hierarchy tab, select OVRSceneManager.
- In the Inspector tab, you can see that the Plane Prefab and Volume Prefab fields are empty. OVRSceneManager will spawn these prefabs for each Scene object that is a plane and volume, respectively.
In order to create a Plane Prefab, do the following:
a. Right click in an empty space in the Hierarchy tab, and click Create Empty. Select the created game object.
b. In the Inspector tab, change the name to Plane Prefab. Reset the Transform, and add a component by searching for OVR Scene Anchor.
c. In the Hierarchy tab, right click on the Plane Prefab game object and select 3D Object > Quad to create a child game object. Select the created game object.
d. In the Inspector tab, reset the Transform and then set the Y Rotation to 180.
(You can reset the Transform from its top-right corner menu in the Inspector, or manually set the Position and Rotation to 0
s and Scale to 1
s.)
e. In the Project tab, create the prefab in your folder. For example, navigate to Assets > Oculus.
f. Drag the Plane Prefab from the Hierarchy tab into the Assets > Oculus folder to create the prefab there.
g. Delete the non-prefab object in the Hierarchy tab.
In order to create a Volume Prefab, do the following:
a. Right click in an empty space in the Hierarchy tab, and click Create Empty. Select the created game object.
b. In the Inspector tab, change the name to Volume Prefab. Reset the Transform, and add a component by searching for OVR Scene Anchor.
c. In the Hierarchy tab, right click on the Volume Prefab game object and select 3D Object > Cube to create a child game object. Select the created game object.
d. In the Inspector tab, reset the Transform and then set the Z Position to -0.5.
e. In the Project tab, create the prefab in your folder. For example, navigate to Assets > Oculus.
f. Drag the Volume Prefab from the Hierarchy tab into the Assets > Oculus folder to create the prefab there.
g. Delete the non-prefab object in the Hierarchy tab.
- In the Hierarchy tab, select OVRSceneManager.
- Drag your Plane Prefab from the Project tab into the OVRSceneManagerPlane Prefab field.
Drag your Volume Prefab from the Project tab into the OVRSceneManagerVolume Prefab field.
The
OVRSceneManager is now set up. Build and run the application. When the app starts, you will be prompted to grant the
Spatial Data Permission. If you have not run
Space Setup, the app will prompt you to capture your space. The app will then load the Scene, instantiating the
Plane Prefab and
Volume Prefab for the relevant Scene objects.
There are a few different directions you can now take.