Class OpenXRFeatureAttribute
Inherited Members
Namespace: UnityEditor.XR.OpenXR.Features
Assembly: Unity.XR.OpenXR.dll
Syntax
[AttributeUsage(AttributeTargets.Class)]
public class OpenXRFeatureAttribute : Attribute
Fields
BuildTargetGroups
BuildTargetsGroups that this feature supports. The feature will only be shown or included on these platforms.
Declaration
public BuildTargetGroup[] BuildTargetGroups
Field Value
Type | Description |
---|---|
BuildTargetGroup[] |
Category
Feature category.
Declaration
public string Category
Field Value
Type | Description |
---|---|
string |
Company
Company that created the feature, shown in the feature configuration UI.
Declaration
public string Company
Field Value
Type | Description |
---|---|
string |
CustomRuntimeLoaderBuildTargets
BuildTargets in this list use a custom runtime loader (that is, openxr_loader.dll). Only one feature per platform can have a custom runtime loader. Unity will skip copying the default loader to the build and use this feature's loader instead on these platforms. Loader must be placed alongside the OpenXRFeature script or in a subfolder of it.
If this field is populated, it signifies that this OpenXRFeature provides its own OpenXR Loader
Declaration
public BuildTarget[] CustomRuntimeLoaderBuildTargets
Field Value
Type | Description |
---|---|
BuildTarget[] |
CustomRuntimeLoaderVersion
OpenXR API version that the OpenXRFeature's custom runtime loader (that is, openxr_loader.dll) supports, as a string. Refer to OpenXR: API Version Numbers and Semantics for specific details on the OpenXR versioning format.
Declaration
public string CustomRuntimeLoaderVersion
Field Value
Type | Description |
---|---|
string |
Remarks
Unity uses the custom runtime loader with the highest OpenXR loader version supported and the highest Priority set.
If no CustomRuntimeLoaderVersion is provided, Unity overrides all other custom loaders with the one provided in this feature. Only one feature per platform can override all other custom runtime loaders.
If more than one feature attempts to override other custom loaders on the same platform, Unity emits an error when an application developer attempts to enter Play mode or build their application. To successfully build a project, the application developer must disable all but one of the conflicting features. To avoid this scenario, you should only override other custom loaders when absolutely necessary.
If no CustomRuntimeLoaderBuildTargets is specified for the OpenXRFeature, this field is ignored. CustomRuntimeLoaderBuildTargets must be populated to signal that this OpenXRFeature provides its own OpenXR Loader
This field does not control the OpenXR API version that is used when launching the application. Use TargetOpenXRApiVersion to indicate that the application should target a specific version of the OpenXR API.
Examples
[OpenXRFeature(
CustomRuntimeLoaderBuildTargets = new []{ BuildTarget.StandaloneWindows64 },
CustomRuntimeLoaderVersion = "1.1.45")]
public class MyCustomLoaderFeature : OpenXRFeature
{
// Implementation code for the custom loader feature
}
Examples of supported version strings:
- "1.1.45"
- "1.0.40"
- "1.0.0"
Example of unsupported version strings:
- "1.0" (requires 3 version numbers major, minor, and patch)
- "1.1.45.0" (extra version numbers)
- "1.4.0f" (version numbers can't include a letter)
Desc
Feature description to show in the UI.
Declaration
public string Desc
Field Value
Type | Description |
---|---|
string |
DocumentationLink
Link to the feature documentation. The help button in the UI opens this link in a web browser.
Declaration
public string DocumentationLink
Field Value
Type | Description |
---|---|
string |
FeatureId
A well known string id for this feature. It is recommended that that id be in reverse DNS naming format (com.foo.bar.feature).
Declaration
public string FeatureId
Field Value
Type | Description |
---|---|
string |
Hidden
Hide this feature from the UI.
Declaration
public bool Hidden
Field Value
Type | Description |
---|---|
bool |
OpenxrExtensionStrings
OpenXR runtime extension strings that need to be enabled to use this extension. If these extensions can't be enabled, a message will be logged, but execution will continue. Can contain multiple extensions separated by spaces.
Declaration
public string OpenxrExtensionStrings
Field Value
Type | Description |
---|---|
string |
Priority
Determines the order in which the feature will be called in both the GetInstanceProcAddr hook list and when events such as OnInstanceCreate are called. Higher priority features will hook after lower priority features and be called first in the event list.
Declaration
public int Priority
Field Value
Type | Description |
---|---|
int |
Required
True if this feature is required, false otherwise. Required features will cause the loader to fail to initialize if they fail to initialize or start.
Declaration
public bool Required
Field Value
Type | Description |
---|---|
bool |
TargetOpenXRApiVersion
The OpenXR API version required by the OpenXRFeature for full functionality Refer to OpenXR: API Version Numbers and Semantics for specific details on the OpenXR versioning format.
Declaration
public string TargetOpenXRApiVersion
Field Value
Type | Description |
---|---|
string |
Remarks
Unity applications will use the highest OpenXR API version requested among all OpenXR Features and the default loader. If the targetted OpenXR API Version is lower than the version specified by the default loader, the default version is used instead.
Examples
[OpenXRFeature(
TargetOpenXRApiVersion = "1.1.45")]
public class MyCustomLoaderFeature : OpenXRFeature
{
}
Examples of supported version strings:
- "1.1.45"
- "1.0.40"
- "1.0.0"
Example of unsupported version strings:
- "1.0" (requires 3 version numbers major, minor, and patch)
- "1.1.45.0" (extra version numbers)
- "1.4.0f" (version numbers can't include a letter)
UiName
Feature name to show in the feature configuration UI.
Declaration
public string UiName
Field Value
Type | Description |
---|---|
string |
Version
Feature version.
Declaration
public string Version
Field Value
Type | Description |
---|---|
string |