API reference

MRUK Class

Extends MonoBehaviour
This class contains convenience functions that allow you to query your scene.

Member Enumerations

Enumeration PositioningMethod

When interacting specifically with tops of volumes, this can be used to specify where the return position should be aligned on the surface e.g.
some apps might want a position right in the center of the table (chess) for others, the edge may be more important (piano or pong)
DEFAULT
No description available
CENTER
No description available
EDGE
No description available

Enumeration SceneDataSource

Specify the source of the scene data.
Device
Load scene data from the device.
Prefab
Load scene data from prefabs.
DeviceWithPrefabFallback
First try to load data from the device and if none can be found fall back to loading from a prefab.
Json
Load Scene from a Json file.
DeviceWithJsonFallback
First try to load data from the device and if none can be found fall back to loading from a Json file.

Enumeration RoomFilter

Specifies the filtering options for selecting rooms within the scene data.
None
No description available
CurrentRoomOnly
No description available
AllRooms
No description available

Enumeration LoadDeviceResult

Return value from the call to LoadSceneFromDevice.
Success
Scene data loaded successfully.
NoScenePermission
User did not grant scene permissions.
NoRoomsFound
No rooms were found (e.g.
FailureDataIsInvalid
Invalid data.
FailureInsufficientResources
Resource limitation prevented this operation from executing.
FailureInsufficientView
Insufficient view.
FailurePermissionInsufficient
Insufficient permission.
FailureRateLimited
Operation canceled due to rate limiting.
FailureTooDark
Too dark.
FailureTooBright
Too bright.

Enumeration SurfaceType

Defines flags for different types of surfaces that can be identified or used within a scene.
FACING_UP
= 1 << 0
FACING_DOWN
= 1 << 1
VERTICAL
= 1 << 2

Properties

Gets a value indicating whether the component has been initialized.
Event that is triggered when the scene is loaded.
Event that is triggered when a room is created.
Event that is triggered when a room is updated.
Event that is triggered when a room is removed.
OVRCameraRig _cameraRig[Get]
List of all the rooms in the scene.
Gets the singleton instance of the MRUK class.

Fields

When world locking is enabled the position of the camera rig will be adjusted each frame to ensure the room anchors are where they should be relative to the camera position.This is necessary to ensure the position of the virtual objects in the world do not get out of sync with the real world.
MRUKSettings SceneSettings[Get]

Member Functions

Register to receive a callback when the scene is loaded.
If the scene is already loaded at the time this is called, the callback will be invoked immediatly.
Parameters
callback
Register to receive a callback when a new room has been created from scene capture.
Parameters
callback
  • MRUKRoom The created room object.
Register to receive a callback when a room has been updated from scene capture.
Parameters
callback
  • MRUKRoom The updated room object.
Registers a callback function to be called before the room is removed.
Parameters
callback
The function to be called when the room is removed. It takes one parameter:
  • MRUKRoom The removed room object.
Get a list of all the rooms in the scene.
Returns
A list of MRUKRoom objects representing all the rooms in the scene.
Get a flat list of all Anchors in the scene.
Returns
A list of MRUKAnchor objects representing all the anchors in the current room.
Returns the current room the headset is in.
If the headset is not in any given room then it will return the room the headset was last in when this function was called. If the headset hasn't been in a valid room yet then return the first room in the list. If no rooms have been loaded yet then return null.
Returns
The current MRUKRoom based on the headset's position, or null if no rooms are available.
Destroys the rooms and all children.
Loads the scene from the data stored on the device.
The user must have granted ScenePermissions or this will fail. In order to check if the user has granted permissions use the following call: Permission.HasUserAuthorizedPermission(OVRPermissionsRequester.ScenePermission) In order to request permissions from the user, use the following call: Permission.RequestUserPermission(OVRPermissionsRequester.ScenePermission, callbacks);
Parameters
requestSceneCaptureIfNoDataFound
If true and no rooms are found when loading from device, the request space setup flow will be started.
removeMissingRooms
When enabled, rooms that are already loaded but are not found in newSceneData will be removed. This is to support the case where a user deletes a room from their device and the change needs to be reflected in the app.
Returns
An enum indicating whether loading was successful or not.
Simulates the creation of a scene in the Editor, using transforms and names from our prefab rooms.
Parameters
scenePrefab
The prefab GameObject representing the scene or a collection of rooms.
clearSceneFirst
If true, clears the current scene before loading the new one.
Serializes the current scene into a JSON string using the specified coordinate system for serialization.
Parameters
coordinateSystem
The coordinate system to be used for serialization (Unity/Unreal).
Returns
A JSON string representing the serialized scene data.
Loads the scene from a JSON string representing the scene data.
Parameters
jsonString
The JSON string containing the serialized scene data.
removeMissingRooms
When enabled, rooms that are already loaded but are not found in JSON the string will be removed.

Static Member Functions

Checks whether any anchors can be loaded.
Returns
Returns a task-based bool, which is true if there are any scene anchors in the system, and false otherwise. If false is returned, then either the scene permission needs to be set, or the user has to run Scene Capture.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon