Class OpenXRInput
OpenXR Input related functionality.
Inherited Members
Namespace: UnityEngine.XR.OpenXR.Input
Syntax
public static class OpenXRInput
Methods
SendHapticImpulse(InputAction, Single, Single, Single, InputDevice)
Send a haptic impulse using the given action
Declaration
public static void SendHapticImpulse(InputAction action, float amplitude, float frequency, float duration, InputDevice inputDevice = null)
Parameters
| Type | Name | Description |
|---|---|---|
| InputAction | action | Action to send haptic impulse through |
| Single | amplitude | Amplitude of the impulse [0-1] |
| Single | frequency | Frequency of the impulse in hertz (Hz). (Typical frequency values are between 0 and 300Hz) (0 = default). Note that not all runtimes support frequency. |
| Single | duration | Duration of the impulse [0-] |
| InputDevice | inputDevice | Optional device to limit haptic impulse to |
SendHapticImpulse(InputAction, Single, Single, InputDevice)
Send a haptic impulse using the given action
Declaration
public static void SendHapticImpulse(InputAction action, float amplitude, float duration, InputDevice inputDevice = null)
Parameters
| Type | Name | Description |
|---|---|---|
| InputAction | action | Action to send haptic impulse through |
| Single | amplitude | Amplitude of the impulse [0-1] |
| Single | duration | Duration of the impulse [0-] |
| InputDevice | inputDevice | Optional device to limit haptic impulse to |
SendHapticImpulse(InputActionReference, Single, Single, Single, InputDevice)
Send a haptic impulse using an action reference
Declaration
public static void SendHapticImpulse(InputActionReference actionRef, float amplitude, float frequency, float duration, InputDevice inputDevice = null)
Parameters
| Type | Name | Description |
|---|---|---|
| InputActionReference | actionRef | Action Reference to send haptic impulse through |
| Single | amplitude | Amplitude of the impulse [0-1] |
| Single | frequency | Frequency of the impulse in hertz (Hz). (Typical frequency values are between 0 and 300Hz) (0 = default). Note that not all runtimes support frequency. |
| Single | duration | Duration of the impulse [0-] |
| InputDevice | inputDevice | Optional device to limit haptic impulse to |
SendHapticImpulse(InputActionReference, Single, Single, InputDevice)
Send a haptic impulse using an action reference
Declaration
public static void SendHapticImpulse(InputActionReference actionRef, float amplitude, float duration, InputDevice inputDevice = null)
Parameters
| Type | Name | Description |
|---|---|---|
| InputActionReference | actionRef | Action Reference to send haptic impulse through |
| Single | amplitude | Amplitude of the impulse [0-1] |
| Single | duration | Duration of the impulse [0-] |
| InputDevice | inputDevice | Optional device to limit haptic impulse to |
StopHaptics(InputAction, InputDevice)
Stop any haptics playing for the given action
Declaration
public static void StopHaptics(InputAction inputAction, InputDevice inputDevice = null)
Parameters
| Type | Name | Description |
|---|---|---|
| InputAction | inputAction | Input action to stop haptics for |
| InputDevice | inputDevice | Optional device filter for actions bound to multiple defices |
StopHaptics(InputActionReference, InputDevice)
Stop any haptics playing for the given action reference
Declaration
public static void StopHaptics(InputActionReference actionRef, InputDevice inputDevice = null)
Parameters
| Type | Name | Description |
|---|---|---|
| InputActionReference | actionRef | Action reference to stop the haptics on. |
| InputDevice | inputDevice | Optional device filter for actions bound to multiple devices. |
TryGetInputSourceName(InputAction, Int32, out String, OpenXRInput.InputSourceNameFlags, InputDevice)
Return the name of the input source bound to the given action
Declaration
public static bool TryGetInputSourceName(InputAction inputAction, int index, out string name, OpenXRInput.InputSourceNameFlags flags = OpenXRInput.InputSourceNameFlags.All, InputDevice inputDevice = null)
Parameters
| Type | Name | Description |
|---|---|---|
| InputAction | inputAction | Input Action |
| Int32 | index | Index of the input source in the case of multiple bindings. |
| String | name | Name of the input source if an input source was found or an empty string if none was found |
| OpenXRInput.InputSourceNameFlags | flags | Flags that indicate which parts of the input source name are requested. |
| InputDevice | inputDevice | Optional input device to limit search to |
Returns
| Type | Description |
|---|---|
| Boolean | True if an input source was found |