Class MockOpenXREnvironmentSettings
Generates blank OpenXR settings and loader assets for testing purposes, while preserving existing settings to be restored after testing is completed.
Implements
Inherited Members
Namespace: UnityEngine.XR.OpenXR.TestTooling
Assembly: Unity.XR.OpenXR.TestTooling.dll
Syntax
public class MockOpenXREnvironmentSettings : IDisposable
Remarks
Use this class to activate and get OpenXR features, and add OpenXR extension strings.
Instances of this class are generated by MockOpenXREnvironment when setting up a Mock XR environment, so you do not need to create instances of this class directly. Instead, use MockOpenXREnvironment to obtain an instance of the settings used by the environment.
Methods
DisableAllFeaturesForBuildTarget(BuildTargetGroup)
Deactivates all OpenXR features to Mock XR environment for a given build target.
Declaration
public static void DisableAllFeaturesForBuildTarget(BuildTargetGroup buildTargetGroup = BuildTargetGroup.Standalone)
Parameters
Type | Name | Description |
---|---|---|
BuildTargetGroup | buildTargetGroup | Unity BuildTargetGroup |
Dispose()
Disposes the MockXR environment settings and restores any backed up settings.
Declaration
public void Dispose()
Remarks
This method does nothing if the MockXR environment settings have already been disposed.
Usually, this method will be called automatically by the MockOpenXREnvironment this instance is associated with.
EnableFeature<F>(bool, BuildTargetGroup)
Activates or deactivates an OpenXR feature to be used in the Mock XR environment for a given build target group.
Declaration
public bool EnableFeature<F>(bool enable, BuildTargetGroup buildTargetGroup = BuildTargetGroup.Standalone) where F : OpenXRFeature
Parameters
Type | Name | Description |
---|---|---|
bool | enable | Set to |
BuildTargetGroup | buildTargetGroup | Unity BuildTargetGroup |
Returns
Type | Description |
---|---|
bool |
|
Type Parameters
Name | Description |
---|---|
F | Type of the OpenXR feature to be modified. The feature must be a subclass of OpenXRFeature. |
Remarks
The feature status can't be changed if any OpenXR loader is running at the moment you call this method.
GetFeature<F>(BuildTargetGroup)
Gets the instance of an OpenXR feature currently set up in the MockXR environment for a given build target group
Declaration
public F GetFeature<F>(BuildTargetGroup buildTargetGroup = BuildTargetGroup.Standalone) where F : OpenXRFeature
Parameters
Type | Name | Description |
---|---|---|
BuildTargetGroup | buildTargetGroup | Unity BuildTargetGroup |
Returns
Type | Description |
---|---|
F | The instance of the OpenXR feature or null if no feature of the specified type was found. |
Type Parameters
Name | Description |
---|---|
F | Type of the OpenXR feature to be retrieved. The feature must be a subclass of OpenXRFeature. |
RequestUseExtension(string)
Requests the use of the provided extension to the list of extensions to be requested to the Mock Runtime.
Declaration
public void RequestUseExtension(string extensionName)
Parameters
Type | Name | Description |
---|---|---|
string | extensionName | Name of the extension to add. |
Remarks
The extensions can only be added before starting the Mock XR environment. Any extension added afterwards will be ignored.
Note that adding the extension name doesn't ensure that it will be activated, Mock Runtime must support it in order to work.