Class OpenXRSettings
Build time settings for OpenXR. These are serialized and available at runtime.
Inherited Members
Namespace: UnityEngine.XR.OpenXR
Assembly: Unity.XR.OpenXR.dll
Syntax
[Serializable]
public class OpenXRSettings : ScriptableObject
Fields
kDefaultColorMode
The default color mode for color render targets.
Declaration
public static readonly OpenXRSettings.ColorSubmissionModeGroup kDefaultColorMode
Field Value
Type | Description |
---|---|
OpenXRSettings.ColorSubmissionModeGroup |
Properties
ActiveBuildTargetInstance
Accessor to OpenXR build time settings.
In the Unity Editor, this returns the settings for the active build target group.
Declaration
public static OpenXRSettings ActiveBuildTargetInstance { get; }
Property Value
Type | Description |
---|---|
OpenXRSettings |
AllowRecentering
Returns the current state of the recentering feature.
Declaration
public static bool AllowRecentering { get; }
Property Value
Type | Description |
---|---|
bool |
FloorOffset
Returns the current floor offset value used when approximating the floor-based position when recentering the space.
Declaration
public static float FloorOffset { get; }
Property Value
Type | Description |
---|---|
float |
Instance
Accessor to OpenXR build time settings.
In the Unity Editor, this returns the settings for the Standalone build target group.
Declaration
public static OpenXRSettings Instance { get; }
Property Value
Type | Description |
---|---|
OpenXRSettings |
autoColorSubmissionMode
Automatically select the default color submission mode.
Declaration
public bool autoColorSubmissionMode { get; set; }
Property Value
Type | Description |
---|---|
bool |
colorSubmissionModes
Gets or sets the preference for what color format the OpenXR display swapchain should use.
Declaration
public OpenXRSettings.ColorSubmissionModeGroup[] colorSubmissionModes { get; set; }
Property Value
Type | Description |
---|---|
ColorSubmissionModeGroup[] |
depthSubmissionMode
Enables XR_KHR_composition_layer_depth if possible and resolves or submits depth to OpenXR runtime.
Declaration
public OpenXRSettings.DepthSubmissionMode depthSubmissionMode { get; set; }
Property Value
Type | Description |
---|---|
OpenXRSettings.DepthSubmissionMode |
featureCount
Number of available features.
Declaration
public int featureCount { get; }
Property Value
Type | Description |
---|---|
int |
foveatedRenderingApi
Different APIs to use in the backend. On Built-in Render Pipeline, only Legacy will be used. On Scriptable Render Pipelines, it is highly recommended to use the SRPFoveation API. More textures will use FDM with the SRPFoveation API.
Declaration
public OpenXRSettings.BackendFovationApi foveatedRenderingApi { get; }
Property Value
Type | Description |
---|---|
OpenXRSettings.BackendFovationApi |
optimizeBufferDiscards
Optimization that allows 4x MSAA textures to be memoryless on Vulkan
Declaration
public bool optimizeBufferDiscards { get; set; }
Property Value
Type | Description |
---|---|
bool |
renderMode
Runtime Stereo rendering mode.
Declaration
public OpenXRSettings.RenderMode renderMode { get; set; }
Property Value
Type | Description |
---|---|
OpenXRSettings.RenderMode |
symmetricProjection
If enabled, when the application begins it will create a stereo symmetric view that has the eye buffer resolution change based on the IPD. Provides a performance benefit across all IPDs.
Declaration
public bool symmetricProjection { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
GetFeature(Type)
Returns the first feature that matches the given type.
Declaration
public OpenXRFeature GetFeature(Type featureType)
Parameters
Type | Name | Description |
---|---|---|
Type | featureType | Type of the feature to return |
Returns
Type | Description |
---|---|
OpenXRFeature | Feature by type |
GetFeature<TFeature>()
Returns the first feature that matches the given type.
Declaration
public TFeature GetFeature<TFeature>() where TFeature : OpenXRFeature
Returns
Type | Description |
---|---|
TFeature | Feature by type |
Type Parameters
Name | Description |
---|---|
TFeature | Type of the feature to retrieve |
GetFeatures()
Return all features.
Declaration
public OpenXRFeature[] GetFeatures()
Returns
Type | Description |
---|---|
OpenXRFeature[] | All features |
GetFeatures(List<OpenXRFeature>)
Return all features.
Declaration
public int GetFeatures(List<OpenXRFeature> featuresOut)
Parameters
Type | Name | Description |
---|---|---|
List<OpenXRFeature> | featuresOut | Output list of features |
Returns
Type | Description |
---|---|
int | Number of features returned |
GetFeatures(Type)
Returns all features of Type.
Declaration
public OpenXRFeature[] GetFeatures(Type featureType)
Parameters
Type | Name | Description |
---|---|---|
Type | featureType | Type of the feature to retrieve |
Returns
Type | Description |
---|---|
OpenXRFeature[] | All components of Type |
GetFeatures(Type, List<OpenXRFeature>)
Returns all features of a given type.
Declaration
public int GetFeatures(Type featureType, List<OpenXRFeature> featuresOut)
Parameters
Type | Name | Description |
---|---|---|
Type | featureType | Type of the feature to retrieve |
List<OpenXRFeature> | featuresOut | Output list of features |
Returns
Type | Description |
---|---|
int | Number of features returned |
GetFeatures<TFeature>()
Returns all features of a given type.
Declaration
public OpenXRFeature[] GetFeatures<TFeature>()
Returns
Type | Description |
---|---|
OpenXRFeature[] | All components of Type |
Type Parameters
Name | Description |
---|---|
TFeature | Type of the feature to retrieve |
GetFeatures<TFeature>(List<TFeature>)
Returns all features of a given type.
Declaration
public int GetFeatures<TFeature>(List<TFeature> featuresOut) where TFeature : OpenXRFeature
Parameters
Type | Name | Description |
---|---|---|
List<TFeature> | featuresOut | Output list of features |
Returns
Type | Description |
---|---|
int | Number of features returned |
Type Parameters
Name | Description |
---|---|
TFeature | Feature type |
GetSettingsForBuildTargetGroup(BuildTargetGroup)
Returns the Settings object for the given BuildTargetGroup
Declaration
public static OpenXRSettings GetSettingsForBuildTargetGroup(BuildTargetGroup buildTargetGroup)
Parameters
Type | Name | Description |
---|---|---|
BuildTargetGroup | buildTargetGroup | BuildTargetGroup to request settings for |
Returns
Type | Description |
---|---|
OpenXRSettings | OpenXRSettings object for the given build target group |
RefreshRecenterSpace()
Regenerates the internal XR space used for recentering, updating the tracking origin to the most recent floor-based position from the runtime.
Declaration
public static void RefreshRecenterSpace()
Remarks
This method needs that AllowRecentering is turned on using SetAllowRecentering(bool, float), otherwise it will do nothing.
This method doesn't trigger a recenter event, as this event has to be initiated from the platform's runtime.
See SetAllowRecentering(bool, float) for more information.
SetAllowRecentering(bool, float)
Activates reference space recentering when using floor-based tracking origin.
Declaration
public static void SetAllowRecentering(bool allowRecentering, float floorOffset = 1.5)
Parameters
Type | Name | Description |
---|---|---|
bool | allowRecentering | Boolean value that activates the recentering feature. |
float | floorOffset | Estimated height used when approximating the floor-based position when recentering the space. By default, this value is 1.5f |
Remarks
When a recentering event is performed, OpenXR will attempt to recenter the world space origin based on the local-floor reference space, if supported by the platform's hardware.
If that reference space isn't supported, OpenXR will then attempt to approximate it using stage space or local space.
Calling this method won't trigger a recenter event. This event will be sent from the platform's runtime.