Class OpenXRInteractionFeature
A Unity OpenXR Interaction feature. This class can be inherited from to add a custom action mapping for OpenXR.
Inherited Members
Namespace: UnityEngine.XR.OpenXR.Features
Assembly: Unity.XR.OpenXR.dll
Syntax
[Serializable]
public abstract class OpenXRInteractionFeature : OpenXRFeature
Properties
IsAdditive
Flag that indicates this feature or profile is additive and its binding paths will be added to other non-additive profiles if enabled.
Declaration
protected virtual bool IsAdditive { get; }
Property Value
| Type | Description |
|---|---|
| bool | Set to |
Methods
AddActionMap(ActionMapConfig)
Add an action map to the Unity Input System.
This method must be called from within the RegisterActionMapsWithRuntime method.
Declaration
protected void AddActionMap(OpenXRInteractionFeature.ActionMapConfig map)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenXRInteractionFeature.ActionMapConfig | map | Action map to add |
AddAdditiveActions(List<ActionMapConfig>, ActionMapConfig)
Override this method to augment other enabled interaction profiles with the additive action bindings provided by this interaction feature.
Declaration
protected virtual void AddAdditiveActions(List<OpenXRInteractionFeature.ActionMapConfig> actionMaps, OpenXRInteractionFeature.ActionMapConfig additiveMap)
Parameters
| Type | Name | Description |
|---|---|---|
| List<OpenXRInteractionFeature.ActionMapConfig> | actionMaps | The set of action maps from all enabled non-additive interaction profiles that can be augmented. |
| OpenXRInteractionFeature.ActionMapConfig | additiveMap | The action map defined by an additive feature that contains extra actions/binding paths intended to be appended to existing non additive interaction profiles. |
Remarks
The stock interaction profiles provide a complete set of actions and bindings for different types of input. They are typically the primary profile for a device (for example, the Oculus Touch Controller Profile for the Quest 2 and the Meta Quest Touch Pro Controller Profile for the Quest Pro). At runtime, the device runtime chooses its preferred profile from those enabled in the Unity project. By default, only the actions and bindings defined in the active, chosen profile are available to the app.
When creating an OpenXR interaction feature to define an interaction profile, you can designate specific bindings as "additive". Additive bindings are inserted into the action maps of other enabled profiles during the OpenXR feature initialization and become available to the app. For example, the D-Pad Binding feature makes thumbstick and trackpad bindings available if the active profile doesn't already contain them.
To enable additve action bindings, your OpenXR interaction feature must:
- Define an action map with one or more actions marked as
isAdditive. (Refer to isAdditive for more information.) - Override this
AddAdditiveActions()function to add the additive actions to each of the maps in theactionMapsparameter.
It looks like the sample you are looking for does not exist.
GetDeviceLayoutName()
Return device layout name string used for register layouts in inputSystem.
Declaration
protected virtual string GetDeviceLayoutName()
Returns
| Type | Description |
|---|---|
| string | Device layout string. |
GetInteractionProfileType()
Return interaction profile type. Default type is XRController. Override this if interactionProfile is not derived from XRController class.
Declaration
protected virtual OpenXRInteractionFeature.InteractionProfileType GetInteractionProfileType()
Returns
| Type | Description |
|---|---|
| OpenXRInteractionFeature.InteractionProfileType | Interaction profile type. |
OnEnabledChange()
Handle enabled state change
Declaration
protected override void OnEnabledChange()
Overrides
OnInstanceCreate(ulong)
Called after xrCreateInstance. Override this method to validate that any necessary OpenXR extensions were
successfully enabled (OpenXRRuntime.IsExtensionEnabled)
and that any required system properties are supported. If this method returns false,
the feature's enabled property is set to false.
Declaration
protected override bool OnInstanceCreate(ulong xrSession)
Parameters
| Type | Name | Description |
|---|---|---|
| ulong | xrSession |
Returns
| Type | Description |
|---|---|
| bool | true if this feature successfully initialized. Otherwise, false. |
Overrides
Remarks
If this feature is a required feature of an enabled feature set, returning false here
causes the OpenXRLoader to fail, and XR Plug-in Management will fall back to another loader if enabled.
See Also
RegisterActionMapsWithRuntime()
Register action maps for this device with the OpenXR Runtime. Called at runtime before Start.
Declaration
protected virtual void RegisterActionMapsWithRuntime()
RegisterDeviceLayout()
Register a device layout with the Unity Input System. Called whenever this interaction profile is enabled in the Editor.
Declaration
protected virtual void RegisterDeviceLayout()
UnregisterDeviceLayout()
Remove a device layout from the Unity Input System. Called whenever this interaction profile is disabled in the Editor.
Declaration
protected virtual void UnregisterDeviceLayout()