EnableWorldLock
: bool |
When world locking is enabled the position and rotation of the OVRCameraRig/TrackingSpace transform 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.
Signature
bool EnableWorldLock |
SceneSettings
: MRUKSettings |
Signature
MRUKSettings SceneSettings |
TrackingSpaceOffset
: Matrix4x4 |
When the EnableWorldLock is enabled, MRUK will modify the TrackingSpace transform, overwriting any manual changes.
Use this field to change the position and rotation of the TrackingSpace transform when the world locking is enabled.
Signature
Matrix4x4 TrackingSpaceOffset |
Instance
: MRUK
[Get] |
Gets the singleton instance of the MRUK class.
Signature
MRUK Instance |
IsInitialized
: bool
[Get] |
Gets a value indicating whether the component has been initialized.
Signature
bool IsInitialized |
IsWorldLockActive
: bool
[Get] |
This property indicates if world lock is currently active.
This means that EnableWorldLock is enabled and the current room has successfully been localized. In some cases such as when the headset goes into standby, the user moves to another room and comes back out of standby the headset may fail to localize and this property will be false. The property may become true again once the device is able to localise the room again (e.g. if the user walks back into the original room). This property can be used to show a UI panel asking the user to return to their room.
Signature
bool IsWorldLockActive |
RoomCreatedEvent
: UnityEvent< MRUKRoom >
[Get] |
Event that is triggered when a room is created.
Signature
UnityEvent<MRUKRoom> RoomCreatedEvent |
RoomRemovedEvent
: UnityEvent< MRUKRoom >
[Get] |
Event that is triggered when a room is removed.
Signature
UnityEvent<MRUKRoom> RoomRemovedEvent |
Rooms
: List< MRUKRoom >
[Get] |
List of all the rooms in the scene.
Signature
List<MRUKRoom> Rooms |
RoomUpdatedEvent
: UnityEvent< MRUKRoom >
[Get] |
Event that is triggered when a room is updated.
Signature
UnityEvent<MRUKRoom> RoomUpdatedEvent |
SceneLoadedEvent
: UnityEvent
[Get] |
Event that is triggered when the scene is loaded.
Signature
UnityEvent SceneLoadedEvent |
TrackerConfiguration
: OVRAnchor.TrackerConfiguration
[Get] |
The current configuration for the tracking service.
To request a particular configuration, set the desired values in MRUKSettings.TrackerConfiguration. This property represents the true state of the system. This may differ from what was requested with MRUKSettings.TrackerConfiguration if, for example, some types of trackables are not supported on the current device.
Signature
OVRAnchor.TrackerConfiguration TrackerConfiguration |
ClearScene
()
|
Destroys the rooms and all children.
Signature
void ClearScene() Returns void |
GetAnchors
()
|
Get a flat list of all Anchors in the scene.
Signature
List< MRUKAnchor > GetAnchors() Returns List< MRUKAnchor >
A list of MRUKAnchor objects representing all the anchors in the current room.
|
GetCurrentRoom
()
|
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.
Signature
MRUKRoom GetCurrentRoom() Returns MRUKRoom
The current MRUKRoom based on the headset's position, or null if no rooms are available.
|
GetRooms
()
|
Get a list of all the rooms in the scene.
Signature
List< MRUKRoom > GetRooms() |
GetTrackables
(
trackables
)
|
Get all the trackables that have been detected so far.
Signature
void GetTrackables(List< MRUKTrackable > trackables) Parameters trackables: List< MRUKTrackable >
The list to populate with the trackables. The list is cleared before adding any elements.
Returns voidThrows ArgumentNullException
Thrown if trackables is null.
|
LoadSceneFromDevice
(
requestSceneCaptureIfNoDataFound
, removeMissingRooms
)
|
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, call Permission.HasUserAuthorizedPermission(OVRPermissionsRequester.ScenePermission).
In order to request permissions from the user, call Permission.RequestUserPermission(OVRPermissionsRequester.ScenePermission, callbacks).
Signature
async Task< LoadDeviceResult > LoadSceneFromDevice(bool requestSceneCaptureIfNoDataFound=true, bool removeMissingRooms=true) Parameters requestSceneCaptureIfNoDataFound: bool
If true and no rooms are found when loading from device, the request space setup flow will be started.
removeMissingRooms: bool
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.
|
LoadSceneFromJsonString
(
jsonString
, removeMissingRooms
)
|
Loads the scene from a JSON string representing the scene data.
Signature
void LoadSceneFromJsonString(string jsonString, bool removeMissingRooms=true) Parameters jsonString: string
The JSON string containing the serialized scene data.
removeMissingRooms: bool
When enabled, rooms that are already loaded but are not found in JSON the string will be removed.
Returns void |
LoadSceneFromPrefab
(
scenePrefab
, clearSceneFirst
)
|
Simulates the creation of a scene in the Editor, using transforms and names from our prefab rooms.
Signature
void LoadSceneFromPrefab(GameObject scenePrefab, bool clearSceneFirst=true) Parameters scenePrefab: GameObject
The prefab GameObject representing the scene or a collection of rooms.
clearSceneFirst: bool
If true, clears the current scene before loading the new one.
Returns void |
LoadSceneFromSharedRooms
(
roomUuids
, groupUuid
, alignmentData
, removeMissingRooms
)
|
Loads the scene based on scene data previously shared with the user via MRUKRoom.ShareRoomAsync.
This function should be used in co-located multi-player experiences by "guest" clients that require scene data previously shared by the "host".
Signature
async Task< LoadDeviceResult > LoadSceneFromSharedRooms(IEnumerable< Guid > roomUuids, Guid groupUuid,(Guid alignmentRoomUuid, Pose floorWorldPoseOnHost)? alignmentData, bool removeMissingRooms=true) Parameters roomUuids: IEnumerable< Guid >
A collection of UUIDs of room anchors for which scene data will be loaded from the given group context.
groupUuid: Guid
UUID of the group from which to load the shared rooms.
alignmentData: (Guid alignmentRoomUuid, Pose floorWorldPoseOnHost)?
Use this parameter to correctly align local and host coordinates when using co-location.alignmentRoomUuid: the UUID of the room used for alignment. floorWorldPoseOnHost: world-space pose of the FloorAnchor on the host device. Using 'null' will disable the alignment, causing the mismatch between the host and the guest. Do this only if your app has custom coordinate alignment. removeMissingRooms: bool
When enabled, rooms that are already loaded but are not found in roomUuids 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.
Throws ArgumentNullException
Thrown if roomUuids is null.
ArgumentException
Thrown if groupUuid equals Guid.Empty.
ArgumentException
Thrown if alignmentData.alignmentRoomUuid equals Guid.Empty.
|
RegisterRoomCreatedCallback
(
callback
)
|
Register to receive a callback when a new room has been created from scene capture.
Signature
void RegisterRoomCreatedCallback(UnityAction< MRUKRoom > callback) Parameters Returns void |
RegisterRoomRemovedCallback
(
callback
)
|
Registers a callback function to be called before the room is removed.
Signature
void RegisterRoomRemovedCallback(UnityAction< MRUKRoom > callback) Parameters callback: UnityAction< MRUKRoom >
The function to be called when the room is removed. It takes one parameter:
Returns void |
RegisterRoomUpdatedCallback
(
callback
)
|
Register to receive a callback when a room has been updated from scene capture.
Signature
void RegisterRoomUpdatedCallback(UnityAction< MRUKRoom > callback) Parameters Returns void |
RegisterSceneLoadedCallback
(
callback
)
|
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.
Signature
void RegisterSceneLoadedCallback(UnityAction callback) Parameters callback: UnityActionReturns void |
SaveSceneToJsonString
(
coordinateSystem
, includeGlobalMesh
, rooms
)
|
Serializes the scene data into a JSON string.
The scene data includes rooms, anchors, and their associated properties. The method allows for the specification of the coordinate system (Unity or Unreal) and whether to include the global mesh data.
Signature
string SaveSceneToJsonString(SerializationHelpers.CoordinateSystem coordinateSystem=SerializationHelpers.CoordinateSystem.Unity, bool includeGlobalMesh=true, List< MRUKRoom > rooms=null) Parameters coordinateSystem: SerializationHelpers.CoordinateSystem
The coordinate system to use for the serialization (Unity or Unreal).
includeGlobalMesh: bool
A boolean indicating whether to include the global mesh data in the serialization. Default is true.
rooms: List< MRUKRoom >
A list of rooms to serialize, if this is null then all rooms will be serialized.
Returns string
A JSON string representing the serialized scene data.
|
ShareRoomsAsync
(
rooms
, groupUuid
)
|
Shares multiple MRUK rooms with a group.
Signature
OVRTask< OVRResult< OVRAnchor.ShareResult > > ShareRoomsAsync(IEnumerable< MRUKRoom > rooms, Guid groupUuid) Parameters groupUuid: Guid
UUID of the group to which the room should be shared.
Returns OVRTask< OVRResult< OVRAnchor.ShareResult > >
A task that tracks the asynchronous operation.
Throws ArgumentNullException
Thrown if rooms is null.
ArgumentException
Thrown if groupUuid equals Guid.Empty.
|
HasSceneModel
()
|
Checks whether any anchors can be loaded.
Signature
static async Task< bool > HasSceneModel() Returns async Task< bool >
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.
|
DataSource
: SceneDataSource |
Signature
SceneDataSource DataSource |
LoadSceneOnStartup
: bool |
Signature
bool LoadSceneOnStartup |
RoomIndex
: int |
Signature
int RoomIndex |
RoomPrefabs
: GameObject[] |
Signature
GameObject [] RoomPrefabs |
SceneJsons
: TextAsset[] |
Signature
TextAsset [] SceneJsons |
SeatWidth
: float |
Signature
float SeatWidth |
TrackableAdded
: UnityEvent< MRUKTrackable >
[Get] |
Invoked when a newly detected trackable has been localized.
When a new OVRAnchor has been detected and localized, a new GameObject with a MRUKTrackable is created to represent it. Its transform is set, and then this event is invoked.
Subscribe to this event to add additional child GameObjects or further customize the behavior.
This example shows how to create a MonoBehaviour that instantiates a custom prefab:
class MyCustomManager : MonoBehaviour
{
public GameObject Prefab;
public void OnTrackableAdded(MRUKTrackable trackable)
{
Instantiate(Prefab, trackable.transform);
}
}
Signature
UnityEvent<MRUKTrackable> TrackableAdded |
TrackableRemoved
: UnityEvent< MRUKTrackable >
[Get] |
Invoked when an existing trackable is no longer detected by the runtime.
When an anchor is removed, no action is taken by default. The MRUKTrackable, if any, is not destroyed or deactivated. Subscribe to this event to change this behavior.
Once this event has been invoked, the MRUKTrackable's anchor (MRUKTrackable.Anchor) is no longer valid.
Signature
UnityEvent<MRUKTrackable> TrackableRemoved |
TrackerConfiguration
: OVRAnchor.TrackerConfiguration
[Get][Set] |
The requested configuration of the tracking service.
This property represents the requested tracker configuration (which types of trackables to track). It is possible that some configuration settings may not be satisfied (for example, due to lack of device support). MRUK.TrackerConfiguration represents the true state of the system.
Signature
OVRAnchor.TrackerConfiguration TrackerConfiguration |
| Member |
|---|
DEFAULT |
CENTER |
EDGE |
| Member | Description |
|---|---|
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.
|
| Member |
|---|
None |
CurrentRoomOnly |
AllRooms |
| Member | Value | Description |
|---|---|---|
Success | OVRAnchor.FetchResult.Success |
Scene data loaded successfully.
|
NoScenePermission | 1 |
User did not grant scene permissions.
|
NoRoomsFound | 2 |
No rooms were found (e.g.
User did not go through space setup)
|
FailureDataIsInvalid | OVRAnchor.FetchResult.FailureDataIsInvalid |
Invalid data.
|
FailureInsufficientResources | OVRAnchor.FetchResult.FailureInsufficientResources |
Resource limitation prevented this operation from executing.
Recommend retrying, perhaps after a short delay and/or reducing memory consumption.
|
FailureInsufficientView | OVRAnchor.FetchResult.FailureInsufficientView |
Insufficient view.
The user needs to look around the environment more for anchor tracking to function.
|
FailurePermissionInsufficient | OVRAnchor.FetchResult.FailurePermissionInsufficient |
Insufficient permission.
Recommend confirming the status of the required permissions needed for using anchor APIs.
|
FailureRateLimited | OVRAnchor.FetchResult.FailureRateLimited |
Operation canceled due to rate limiting.
Recommend retrying after a short delay.
|
FailureTooDark | OVRAnchor.FetchResult.FailureTooDark |
Too dark.
The environment is too dark to load the anchor.
|
FailureTooBright | OVRAnchor.FetchResult.FailureTooBright |
Too bright.
The environment is too bright to load the anchor.
|
| Member | Value |
|---|---|
FACING_UP | 1 << 0 |
FACING_DOWN | 1 << 1 |
VERTICAL | 1 << 2 |